Class: Nochmal::Adapters::Carrierwave
- Defined in:
- lib/nochmal/adapters/carrierwave.rb
Overview
collect common things for the carrierwave analysis and migration
Direct Known Subclasses
Constant Summary collapse
- PREFIX =
"carrierwave_"
Instance Method Summary collapse
Methods inherited from Base
#attachment_types_for, #count, #empty_collection?, #from_storage_service, #general_notes, #initialize, #item_completed, #list, #model_completed, #reupload, #setup, #teardown, #to_storage_service, #type_completed, #type_notes, #validate
Constructor Details
This class inherits a constructor from Nochmal::Adapters::Base
Instance Method Details
#blob(attachment) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/nochmal/adapters/carrierwave.rb', line 24 def blob() Pathname.new( .file.file.gsub( .mounted_as.to_s, not_prefixed(.mounted_as).to_s ) ) end |
#collection(model, uploader) ⇒ Object
20 21 22 |
# File 'lib/nochmal/adapters/carrierwave.rb', line 20 def collection(model, uploader) maybe_sti_scope(model).where.not(db_column(uploader) => nil) end |
#models_with_attachments ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nochmal/adapters/carrierwave.rb', line 9 def @models_with_attachments ||= begin Rails.application.eager_load! ActiveRecord::Base .descendants .reject(&:abstract_class?) .select { |model| carrierwave?(model) } end end |