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
56 57 58 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 56 def connection @connection ||= uploader.model.class.connection.raw_connection end |
#identifier ⇒ Object
52 53 54 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 52 def identifier @oid ||= create_large_object end |
#retrieve!(identifier) ⇒ Object
46 47 48 49 50 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 46 def retrieve!(identifier) raise "This uploader must be mounted in an ActiveRecord model to work" unless uploader.model @oid = identifier CarrierWave::Storage::PostgresqlLo::File.new(uploader) end |
#store!(file) ⇒ Object
39 40 41 42 43 44 |
# File 'lib/carrierwave/storage/postgresql_lo.rb', line 39 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 |