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
80 81 82 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 80 def connection @connection ||= uploader.model.connection.raw_connection end |
#identifier ⇒ Object
76 77 78 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 76 def identifier @oid ||= uploader.model.read_attribute(uploader.mounted_as) || connection.lo_creat end |
#retrieve!(identifier) ⇒ Object
71 72 73 74 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 71 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
64 65 66 67 68 69 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 64 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 |