Rake db:migrate problem

I am just starting out learning RoR. I am trying to follow along with
the Depot project in “Agile Web D. With Rails ed2” and get the
error “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.[]” I ran --trace and get the following, but I am not sure what it
means. Can anyone help me make sense out of it? Thanks

Mike R.

(in /Users/mike/work/depot)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== AddPrice: migrating

– add_column(:products, :price, :decimal, {:default=>0, :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.[]
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:259:in
type_to_sql' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:122:inadd_column’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:273:in
send' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:273:inmethod_missing’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in
say_with_time' /opt/local/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:257:in
say_with_time' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:271:inmethod_missing’
./db/migrate//002_add_price.rb:8:in real_up' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:210:insend’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:210:in
migrate' /opt/local/lib/ruby/1.8/benchmark.rb:293:inmeasure’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:210:in
migrate' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:333:inmigrate’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:328:in
each' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:328:inmigrate’
/opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:295:in
up' /opt/local/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.rb:286:inmigrate’
/opt/local/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/tasks/databases.rake:4
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in call' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:inexecute’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:inexecute’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in invoke' /opt/local/lib/ruby/1.8/thread.rb:135:insynchronize’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in invoke' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:inrun’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in each' /opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:inrun’
/opt/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
/opt/local/bin/rake:18:in `load’
/opt/local/bin/rake:18

On 11/16/06, Mike R. [email protected] wrote:

I am just starting out learning RoR. I am trying to follow along with
the Depot project in “Agile Web D. With Rails ed2” and get the
error “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.[]” I ran --trace and get the following, but I am not sure what it
means. Can anyone help me make sense out of it? Thanks

You need to upgrade your rails version for this example to work. The
decimal type isn’t supported by the current stable release.

I’m sure this procedure is described somewhere close to the example.

HTH,
Isak

On Thu, 2006-11-16 at 15:07 +0100, Mike R. wrote:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== AddPrice: migrating

– add_column(:products, :price, :decimal, {:default=>0, :precision=>8,
:scale=>2})
rake aborted!
You have a nil object when you didn’t expect it!


My understanding of AWDWR ed 2 is that it requires Rails 1.2 which isn’t
available yet in any form other than ‘edge rails’ which by default,
isn’t what gets installed.

I hesitated to reply because I am uncertain of the incantation required
to get edge rails installed and functional

Craig

On Nov 16, 2006, at 7:07 AM, Mike R. wrote:

I am just starting out learning RoR. I am trying to follow along with
the Depot project in “Agile Web D. With Rails ed2” and get
the
error “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.[]” I ran --trace and get the following, but I am not sure
what it
means. Can anyone help me make sense out of it? Thanks

The book is written for Rails 1.2, but there seem to be some problems
getting that released. In the meantime, I prepared a temporary
release that helps you install Edge Rails in your application. If yo
look at the second page of the PDF (the one after the cover page)
you’ll find an explanation and instructions.

Regards

Dave T.

Dave T. wrote:

The book is written for Rails 1.2, but there seem to be some problems
getting that released. In the meantime, I prepared a temporary
release that helps you install Edge Rails in your application. If yo
look at the second page of the PDF (the one after the cover page)
you’ll find an explanation and instructions.

Regards

Dave T.

Thanks Dave,

I ran the rake rails:update as shown on the second page, but never
checked to see if it actually work. Looks like the problem was it
didn’t. I did get the update to take by rails:freeze:edge and now the
database updates. It is a great book so far.

Thanks
Mike R.