Sha256: 9acb063e30747a1d4ec47bee79badb087a30a7c3588fbc7ebdf4be2c4b6cdbaa

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# encoding: utf-8

module CarrierWave
  module Backgrounder
    module ORM

      module ActiveModel
        include CarrierWave::Backgrounder::ORM::Base

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

          mod = Module.new
          include mod
          mod.module_eval  <<-RUBY, __FILE__, __LINE__ + 1
            def trigger_#{column}_background_processing?
              super && (#{column}_changed? || previous_changes.has_key?(:#{column}) || remote_#{column}_url.present?)
            end
          RUBY
        end

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

          mod = Module.new
          include mod
          mod.module_eval  <<-RUBY, __FILE__, __LINE__ + 1
            def trigger_#{column}_background_storage?
              super && (#{column}_changed? || previous_changes.has_key?(:#{column}) || remote_#{column}_url.present?)
            end
          RUBY
        end
      end # ActiveModel

    end # ORM
  end # Backgrounder
end # CarrierWave

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carrierwave_backgrounder-0.0.9 lib/backgrounder/orm/activemodel.rb