Sha256: c10e98f7464e5f8d770ef675d19e91005a2fd74811eab7b63355dd3516857005

Contents?: true

Size: 1020 Bytes

Versions: 1

Compression:

Stored size: 1020 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? || 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? || remote_#{column}_url.present?)
            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.8 lib/backgrounder/orm/mongoid.rb