If, in the controller, I start a worker and pass in an argument like this: session[:job_key] = MiddleMan.new_worker(:class => :foo_worker, :args => {:emrec_id => @emrec.id}) How do I access the value in the worker? I can''t seem to figure it out ;-p Thanks! Bill -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061017/48549ab5/attachment.html
Thank you, Rob! I really appreciate it. Best regards, Bill ----- Original Message ----- From: Rob Biedenharn To: Bill Walton Sent: Tuesday, October 17, 2006 1:38 PM Subject: Re: [Backgroundrb-devel] accessing args in worker On Oct 17, 2006, at 2:15 PM, Bill Walton wrote: If, in the controller, I start a worker and pass in an argument like this: session[:job_key] = MiddleMan.new_worker(:class => :foo_worker, :args => {:emrec_id => @emrec.id}) How do I access the value in the worker? I can''t seem to figure it out ;-p Thanks! Bill def do_work(args) @emred_id = args[:emrec_id] # ... do more stuff ... end -Rob Rob Biedenharn http://agileconsultingllc.com Rob at AgileConsultingLLC.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20061017/843a0bcd/attachment.html
On Oct 17, 2006, at 11:15 AM, Bill Walton wrote:> If, in the controller, I start a worker and pass in an argument > like this: > > session[:job_key] = MiddleMan.new_worker(:class => :foo_worker, > :args => {:emrec_id => > @emrec.id}) > > How do I access the value in the worker? I can''t seem to figure it > out ;-p > > Thanks! > BillHey Bill- You will be able to access that hash in your do_work method as args [:emrec_id] Cheers- -- Ezra Zygmuntowicz -- Lead Rails Evangelist -- ez at engineyard.com -- Engine Yard, Serious Rails Hosting -- (866) 518-YARD (9273)