You do not need to pass parameters to the handle_asynchronously method, this is just a way of saying that your method should always be passed to delayed_job.
So in your example:
def create_user(name,pass,time) puts name,pass,time end handle_asynchronously :create_user
does exactly what you need. When you call
create_user('john','foo',Time.now)
is the same as a challenge
delay.create_user('john','foo',Time.now)
I just installed the test application, doing just that to check the answer, and here is the serialized delayed_job handler:
--- !ruby/struct:Delayed::PerformableMethod object: !ruby/ActiveRecord:User attributes: name: pass: created_at: updated_at: method_name: :create_user_without_delay args: - John - foo - 2011-03-19 10:45:40.290526 -04:00
Unixmonkey
source share