Module: CarrierWave::Backgrounder::ORM::DataMapper

Includes:
Base
Defined in:
lib/backgrounder/orm/data_mapper.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
17
# File 'lib/backgrounder/orm/data_mapper.rb', line 8

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

  class_eval  <<-RUBY, __FILE__, __LINE__ + 1
    def set_#{column}_processing
      @#{column}_changed = attribute_dirty?(:#{column})
      self.#{column}_processing = true if respond_to?(:#{column}_processing)
    end
  RUBY
end

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



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/backgrounder/orm/data_mapper.rb', line 19

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

  class_eval  <<-RUBY, __FILE__, __LINE__ + 1
    def set_#{column}_changed
      @#{column}_changed = attribute_dirty?(:#{column})
    end

    def write_#{column}_identifier
      super and return if process_#{column}_upload
      self.#{column}_tmp = #{column}_cache
    end
  RUBY
end