Forum: Ruby on Rails Nil error when trying to rake

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Db42cf321b071c91db03bf38c928c7fa?d=identicon&s=25 Jonathan Carter (taieech)
on 2007-01-02 16:35
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,
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)


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.. :(  the code is pasted below..

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

  def self.down
  remove_column :products, :price

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 :P

Thanks for any help!
2b106a766c761b174a0734125b8de1c0?d=identicon&s=25 Kevin Nelson (cbx)
on 2007-01-19 03:45
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
2b106a766c761b174a0734125b8de1c0?d=identicon&s=25 Kevin Nelson (cbx)
on 2007-01-19 03:51
found some more info here, but this is still not working.
This topic is locked and can not be replied to.