Everytime an object has been created i want to enqueue it in a Redis queue to check for certain properties. How can i add the created object directly as a parameter to the callback? So my redis job would do something like this:
class FurtherProcessCarJob
#....
def self.perform(order)
puts order.id
end
end
whereas in the model
after_create Resque.enqueue FurtherProcessCar, #self
It is possible to hook a method to the callback and there look for the car again and the enqueue the object, but is it possible to do it directly?
As I understand your question, something like this should work
class YourModel < ActiveRecord::Base
#....
after_create :enqueue_to_redis
private
def enque_to_redis
Resque.enqueue self, other_args
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With