RailsCasts Pro episodes are now free!

Learn more or hide this

ray neville's Profile

GitHub User: rayzor

Site: grainmaster.net

Comments by ray neville

Avatar

One very good explanation why my approach does not work.

http://stackoverflow.com/questions/10930300/delayed-job-and-prawn-scripts

load "#{Rails.root}/jobs/#{prawn_script_name}.rb" DOES WORK.

BUT

I need to pass arguments e.g account_id to the Prawn scripts to scope the data for the pdfs.

runner allows ARG[]s to be passed but "load" does not!

Delayed_job has the arguments in its table but how do I make these accessible to the Prawn scripts?

This is my next hurdle to overcome.

Avatar

Changed from Bj(no longer supported in Rail3) to Delayed_job but seems not to handle rails runner.

lib/report_job.rb
class ReportJob < Struct.new(:prawn_script_name , :account_id )
def perform
bundle exec rails runner "#{Rails.root}/jobs/#{prawn_script_name}.rb #{account_id}"
end

Error in last_error field.
{undefined method `runner' for #ReportJob:0xc28f080

OUCH! .... will try Resque.