Module: Backgrounded::ActiveRecordExtension::ClassMethods

Defined in:
lib/backgrounded/active_record_extension.rb

Instance Method Summary collapse

Instance Method Details

#after_commit_backgrounded(method_name, options = {}) ⇒ Object

execute a method in the background after the object is committed to the database

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :backgrounded (Hash) — default: optional

    options to pass into the backgrounded handler

See Also:

  • after_commit


11
12
13
14
15
# File 'lib/backgrounded/active_record_extension.rb', line 11

def after_commit_backgrounded(method_name, options={})
  self.after_commit options.except(:backgrounded) do |instance|
    instance.backgrounded(options[:backgrounded]).send(method_name)
  end
end