Nil error when trying to rake


#1

I have been studying/working from the “Agile Rails” book for a little
while, and I am at the point where we are building the program called
‘depot’, I am doing my second migrate and I receive an error… the error
is as follows:

C:\InstantRails\rails_apps\depot>rake db:migrate
(in C:/InstantRails/rails_apps/depot)
== AddPrice: migrating
========================================================
-- add_column(:products, :price, :decimal, {:precision=>8, :scale=>2,
:default=>
0})
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.[]

(See full trace by running task with --trace)

C:\InstantRails\rails_apps\depot>

The code I am using is directly from the book itself, and I have been
trying to research this on the rails documentation, but its of little
use… :frowning: the code is pasted below…

class AddPrice < ActiveRecord::Migration
  def self.up
  add_column :products, :price, :decimal, :precision => 8, :scale => 2,
:default => 0
  end

  def self.down
  remove_column :products, :price
  end
end

As well, (maybe its convenient), I have pasted the versions of
everything I am currently running.

Ruby version 1.8.5 (i386-mswin32)
RubyGems version 0.9.0
Rails version 1.1.6
Active Record version 1.14.4
Action Pack version 1.12.5
Action Web Service version 1.1.6
Action Mailer version 1.2.5
Active Support version 1.3.1
Application root C:/InstantRails/rails_apps/depot
Environment development
Database adapter mysql
Database schema version 1

I hope someone is able to help, I am wanting to study more, and learn,
but this is sorta breaking that apart :stuck_out_tongue:

Thanks for any help!


#2

I am having the same problem!

Of course, I was hoping I’d find a solution in addition to someone with
the same problem.

Have you figured this out yet?

Also, what system are you running on?

fwiw, I am on a 2.33GHz Core 2 Duo MacBook Pro running OS 10.4.8


#3

found some more info here, but this is still not working.
http://railsforum.com/viewtopic.php?id=2010