module Eitil class SingleMethodJob < ApplicationJob queue_as :default # BEWARE: _self is currently not accepted in perform_later jobs due to serialization errors # The cases of 'id' and '_self' both handle instances, with the difference # being that 'id' works for objects that have a database record, while '_self' # works for non database supported instanes, such as an Exporter instance. def perform(_class:, _method:, id: nil, _self: nil) binding.pry object = if id _class.constantize.find(id) elsif _self _self else _class.constantize end object.send _method end end end