class CarrierWave::Storage::PostgresqlTable

Public Instance Methods

cache!(new_file) click to toggle source
# File lib/carrierwave/storage/postgresql_table.rb, line 21
def cache!(new_file)
  f = CarrierWave::Storage::PostgresqlTable::File.new(uploader.cache_path)
  f.store(new_file)
  f
end
clean_cache!(seconds) click to toggle source
# File lib/carrierwave/storage/postgresql_table.rb, line 36
def clean_cache!(seconds)
  time = Time.now - seconds.seconds
  CarrierWaveFile.delete_all_files("path LIKE #{CarrierWaveFile.connection.quote(::File.join(uploader.cache_dir, "%"))} AND updated_at < #{CarrierWaveFile.connection.quote(time)}")
end
delete_dir!(path) click to toggle source
# File lib/carrierwave/storage/postgresql_table.rb, line 31
def delete_dir!(path)
  # This is only supposed to delete *empty* directories, which don't
  # exist in our database.
end
retrieve!(identifier) click to toggle source
# File lib/carrierwave/storage/postgresql_table.rb, line 17
def retrieve!(identifier)
  CarrierWave::Storage::PostgresqlTable::File.new(uploader.store_path(identifier))
end
retrieve_from_cache!(identifier) click to toggle source
# File lib/carrierwave/storage/postgresql_table.rb, line 27
def retrieve_from_cache!(identifier)
  CarrierWave::Storage::PostgresqlTable::File.new(uploader.cache_path(identifier))
end
store!(file) click to toggle source
# File lib/carrierwave/storage/postgresql_table.rb, line 6
def store!(file)
  if (uploader.move_to_store && file.kind_of?(CarrierWave::Storage::PostgresqlTable::File))
    file.move_to(uploader.store_path)
    file
  else
    f = CarrierWave::Storage::PostgresqlTable::File.new(uploader.store_path)
    f.store(file)
    f
  end
end