Sha256: 7a6083871fd6514d1fa2e8be9765c2feeb266e90629c43819b8a536771e6fa5c

Contents?: true

Size: 949 Bytes

Versions: 1

Compression:

Stored size: 949 Bytes

Contents

module CarrierWave
  module Backgrounder
    module ORM

      module Mongoid
        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?
            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?
            end
          RUBY
        end
      end # ActiveRecord

    end # ORM
  end # Backgrounder
end # CarrierWave

Mongoid::Document::ClassMethods.send(:include, ::CarrierWave::Backgrounder::ORM::Mongoid)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carrierwave_backgrounder-0.0.7 lib/backgrounder/orm/mongoid.rb