title: "rake aborted! undefined method `[]=' for nil:NilClass" message when running rake in cron job
body: <p>I am a ROR noob who has inherited a project (Ruby version 1.9.3p0, Rails version 3.0.6, rake version 0.9.2) which performs a rake as part of a cronjob. This has been outputting "rake aborted! undefined method `[]=' for nil:NilClass" into its log file. When I perform a trace I get the following output: </p>
  
  <pre><code>rake aborted!
  undefined method `[]=' for nil:NilClass
  /var/www/nostos-source-illiad/lib/nostos-source-illiad/record.rb:48:in `block in charge!'
  (eval):22:in `form_with'
  /var/www/nostos-source-illiad/lib/nostos-source-illiad/record.rb:47:in `charge!'
  /var/www/nostos/app/models/transaction.rb:65:in `block (2 levels) in sync!'
  /var/www/nostos/app/models/transaction.rb:58:in `each'
  /var/www/nostos/app/models/transaction.rb:58:in `block in sync!'
  /var/www/nostos/app/models/transaction.rb:57:in `each'
  /var/www/nostos/app/models/transaction.rb:57:in `sync!'
  /var/www/nostos/lib/tasks/nostos.rake:17:in `block (2 levels) in &lt;top (required)&gt;'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/rake-0.9.2/bin/rake:32:in `&lt;top (required)&gt;'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bin/rake:19:in `load'
  /home/deployer/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/bin/rake:19:in `&lt;main&gt;'
  Tasks: TOP =&gt; nostos:cron
  </code></pre>
  
  <p>I am having trouble determining what exactly is causing this issue and was looking for some advice/direction. I do not think this is caused by the same issue reported <a href="https://stackoverflow.com/questions/7623983/rake-undefined-method-for-nilnilclass">here</a> but I am not definite. Any help would be appreciated. Thanks!</p>
  
  <p>EDIT:
  Code for <code>nostos:rake</code>can be found <a href="https://github.com/bricestacey/nostos/blob/master/lib/tasks/nostos.rake" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Code for <code>transaction.rb</code> can be found <a href="https://github.com/bricestacey/nostos/blob/master/app/models/transaction.rb" rel="nofollow noreferrer">here</a>.</p>