Sha256: 77ea4ce514d9d1890f1e038776d77c6d6ec2302e85b91838e6a3d485bc665d58

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

# encoding: utf-8
require 'active_record'

module CarrierWave
  module Backgrounder
    module ORM

      module ActiveRecord
        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

ActiveRecord::Base.extend CarrierWave::Backgrounder::ORM::ActiveRecord

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
carrierwave_backgrounder-0.0.8 lib/backgrounder/orm/activerecord.rb