Sha256: 50d37b97dcbec654d4c06a66e2b4b94caf3f58f284934ad645619c38c5b6e5e1
Contents?: true
Size: 1.39 KB
Versions: 5
Compression:
Stored size: 1.39 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) before_save :"set_#{column}_processing", :if => :"enqueue_#{column}_background_job?" send _supported_am_after_callback, :"enqueue_#{column}_background_job", :if => :"enqueue_#{column}_background_job?" super end def store_in_background(column, worker=::CarrierWave::Workers::StoreAsset) send _supported_am_after_callback, :"enqueue_#{column}_background_job", :if => :"enqueue_#{column}_background_job?" super end private def _supported_am_after_callback respond_to?(:after_commit) ? :after_commit : :after_save end def _define_shared_backgrounder_methods(mod, column, worker) super define_method :"#{column}_updated?" do send(:"#{column}_changed?") || # after_save support previous_changes.has_key?(:"#{column}") || # after_commit support send(:"remote_#{column}_url").present? || # Remote upload support send(:"#{column}_cache").present? # Form failure support end end end # ActiveModel end # ORM end # Backgrounder end # CarrierWave
Version data entries
5 entries across 5 versions & 1 rubygems