Reputation: 7866
I'm using delayed_job gem.
I want to call a method using a callback as follows
after_update :get_score
How can I use delay_job for this so that the get_score method is run in the background?
Upvotes: 1
Views: 753
Reputation: 638
How about this? Works for me.
after_update :get_score
private
def get_score
# code
end
handle_asynchronously :get_score
Upvotes: 3
Reputation: 7480
I'm not too familiar with delayed_job
, but judging from its docs, this should work.
after_update :obtain_score
def get_score
# code
end
private
def obtain_score
delay.get_score
end
Upvotes: 0