> you should be able to access it via ENV as systemu merges that in for
> you
> 
>    var = ENV['var']
> 
> should be all you need, assuming you specified that var in the call
> the bj submit...

> use ENV


I've been struggling to get this to function.. Any help would be 
appreciated :)

While i have successfully created, by using bj, a text only PDF using 
prawn/prawnto, i cannot successfully pass variables (ie an account ref) 
through with :env , despite the earlier advice in this thread. Is it 
possible, that in some circumstances, the full set of ENV would not be 
passed to the bj background task ?

#-------------------------------------------------------
def bj_simple_prawn
  Bj.submit "./script/runner ./script/simple_prawn_script.rb", :env => { 
:avar => @current_user.account_id,  :bvar => 27 }
end

After submitting the job..

bj_job has the following in the :env field;

  ---
  :bvar: 27
  :avar: 1

I cannot seem to access :env field/variable from bj_job table in the 
worker task

# This line fails to extract the value passed in :env

 @this_user = ENV['myvar']

The following works ! - if use a fixed value, 1.
  @this_user = 1

@myaccount = Account.find(:first, :conditions => ["accounts.id=?", 
@this_user])


Question : How does one access the values passed in the job :env ? I 
suspect a syntax error on my part , but cannot pin it down :(
Like i say ... any help /pointer would be appreciated..

Denis



-- 
Posted via http://www.ruby-forum.com/.