47d9c79617
This allows us to directly pass entities to the job.
22 lines
579 B
Ruby
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
|