Sha256: b42b07cfd3bf21c59a0779e48afb3ef93387f642e1c0612c4922f141e5de1cdc

Contents?: true

Size: 1.04 KB

Versions: 2

Compression:

Stored size: 1.04 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

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

        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? || previous_changes.has_key?(:#{column}) || remote_#{column}_url.present?)
            end
          RUBY
        end
      end # ActiveModel

    end # ORM
  end # Backgrounder
end # CarrierWave

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
carrierwave_backgrounder-0.1.1 lib/backgrounder/orm/activemodel.rb
carrierwave_backgrounder-0.1.0 lib/backgrounder/orm/activemodel.rb