module SuckerPunch::Backgroundable::CallMethod
Private Instance Methods
call(receiver, method, *args)
click to toggle source
# File lib/sucker_punch/backgroundable/job.rb, line 16 def call(receiver, method, *args) if defined?(ActiveRecord) begin ActiveRecord::Base.connection_pool.with_connection do receiver.send(method, *args) end ensure ActiveRecord::Base.connection_handler.clear_active_connections! end else receiver.send(method, *args) end end
instantiate?(options)
click to toggle source
# File lib/sucker_punch/backgroundable/job.rb, line 7 def instantiate?(options) return true if SuckerPunch::Backgroundable.configuration.reload && !(!options[:reload].nil? && options[:reload] == false) options[:reload] end
load(receiver)
click to toggle source
# File lib/sucker_punch/backgroundable/job.rb, line 12 def load(receiver) receiver.respond_to?(:id) ? receiver.class.find(receiver.id) : receiver end