Module: CarrierWave::Backgrounder::ORM::Mongoid

Includes:
Base
Defined in:
lib/backgrounder/orm/mongoid.rb

Instance Method Summary collapse

Instance Method Details

#process_in_background(column, worker = ::CarrierWave::Workers::ProcessAsset) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/backgrounder/orm/mongoid.rb', line 8

def process_in_background(column, worker=::CarrierWave::Workers::ProcessAsset)
  super

  class_eval  <<-RUBY, __FILE__, __LINE__ + 1
    def trigger_#{column}_background_processing?
      process_#{column}_upload != true && (#{column}_changed? || remote_#{column}_url.present?)
    end
  RUBY
end

#store_in_background(column, worker = ::CarrierWave::Workers::StoreAsset) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/backgrounder/orm/mongoid.rb', line 18

def store_in_background(column, worker=::CarrierWave::Workers::StoreAsset)
  super

  class_eval  <<-RUBY, __FILE__, __LINE__ + 1
    def trigger_#{column}_background_storage?
      process_#{column}_upload != true && (#{column}_changed? || remote_#{column}_url.present?)
    end
  RUBY
end