foodsoft/config/initializers/active_job_select_foodcoop.rb
Patrick Gansterer 47d9c79617 Use ActiveJob instead of Resque directly
This allows us to directly pass entities to the job.
2021-03-08 12:30:58 +01:00

22 lines
579 B
Ruby

module FoodsoftActiveJobArguments
def self.included(base) # :nodoc:
base.class_eval do
alias_method :orig_deserialize, :deserialize
alias_method :orig_serialize, :serialize
def serialize(arguments)
ret = orig_serialize(arguments)
ret.unshift FoodsoftConfig.scope
end
def deserialize(arguments)
FoodsoftConfig.select_multifoodcoop arguments.shift
orig_deserialize(arguments)
end
end
end
end
ActiveSupport.on_load(:after_initialize) do
ActiveJob::Arguments.include FoodsoftActiveJobArguments
end