I’m having a problem with one of the migration files from the depot
application.
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== AddPrice: migrating
– add_column(:products, :price, :decimal, {:scale=>2, :default=>0,
:precision=>
8})
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.[]
I’ve checked this against the latest pdf of the book so it all seems to
jive.
Here is the migration file:
#—
Excerpted from “Agile Web D. with Rails, 2nd Ed.”
We make no guarantees that this code is fit for any purpose.
Visit http://www.pragmaticprogrammer.com/titles/rails2 for more book
information.
#—
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
Stuart