Class: CarrierWave::Storage::PostgresqlLo
- Inherits:
-
Abstract
- Object
- Abstract
- CarrierWave::Storage::PostgresqlLo
- Defined in:
- lib/carrierwave/storage/postgresql_lo.rb
Defined Under Namespace
Classes: File
Instance Method Summary collapse
Instance Method Details
#connection ⇒ Object
81 82 83 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 81 def connection @connection ||= uploader.model.class.connection.raw_connection end |
#identifier ⇒ Object
77 78 79 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 77 def identifier @oid ||= uploader.model.read_attribute(uploader.mounted_as) || connection.lo_creat end |
#retrieve!(identifier) ⇒ Object
72 73 74 75 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 72 def retrieve!(identifier) raise "This uploader must be mounted in an ActiveRecord model to work" unless uploader.model CarrierWave::Storage::PostgresqlLo::File.new(uploader) end |
#store!(file) ⇒ Object
65 66 67 68 69 70 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 65 def store!(file) raise "This uploader must be mounted in an ActiveRecord model to work" unless uploader.model stored = CarrierWave::Storage::PostgresqlLo::File.new(uploader) stored.write(file) stored end |