module CarrierWave::Backgrounder::ORM::ActiveModel

Private Instance Methods

_define_shared_backgrounder_methods(mod, column, worker) click to toggle source
Calls superclass method CarrierWave::Backgrounder::ORM::Base#_define_shared_backgrounder_methods
# File lib/backgrounder/orm/activemodel.rb, line 12
def _define_shared_backgrounder_methods(mod, column, worker)
  before_save :"set_#{column}_processing", :if => :"enqueue_#{column}_background_job?"
  send _supported_callback, :"enqueue_#{column}_background_job", :if => :"enqueue_#{column}_background_job?"

  super

  define_method :"#{column}_updated?" do
    options = self.class.uploader_options[column] || {}
    serialization_column = options[:mount_on] || column

    send(:"#{serialization_column}_changed?") ||              # after_save support
    previous_changes.has_key?(:"#{serialization_column}") ||  # after_commit support
    send(:"remote_#{column}_url").present? ||                 # Remote upload support
    send(:"#{column}_cache").present?                         # Form failure support
  end
end
_supported_callback() click to toggle source
# File lib/backgrounder/orm/activemodel.rb, line 29
def _supported_callback
  respond_to?(:after_commit) ? :after_commit : :after_save
end