Class: CarrierWave::Storage::PostgresqlLo::File
Instance Method Summary
collapse
#delete, #file_length, #read, #write
#delete, #file_length, #read, #write
Constructor Details
#initialize(uploader) ⇒ File
Returns a new instance of File.
12
13
14
|
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 12
def initialize(uploader)
@uploader = uploader
end
|
Instance Method Details
#connection ⇒ Object
25
26
27
|
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 25
def connection
@connection ||= @uploader.model.class.connection.raw_connection
end
|
#content_type ⇒ Object
20
21
|
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 20
def content_type
end
|
#identifier ⇒ Object
29
30
31
|
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 29
def identifier
@oid ||= @uploader.identifier.to_i
end
|
#original_filename ⇒ Object
33
34
35
|
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 33
def original_filename
identifier.to_s
end
|
#url ⇒ Object
16
17
18
|
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 16
def url
"/#{@uploader.model.class.name.underscore.gsub('/', '_')}_#{@uploader.mounted_as.to_s.underscore}/#{identifier}"
end
|