I’m following along with the example in Agile, and I’m simply trying to
create a migration to add a price column to a table called products.
This table exists as my application is displaying it using a scaffold.
Here’s my migration:
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
However when I run my migration I get the following:
powerbook-g4-15:~/Documents/work/depot drew$ rake db:migrate
(in /Users/drew/Documents/work/depot)
== AddPrice: migrating
– add_column(:products, :price, :decimal, {:precision=>8, :default=>0,
: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)
Any help would be great… I feel like a moron, I’m sure I’ve gotten
this working before, just trying to follow along with the example in the
book.
Drew, Agile v2 requires edge/1.2. I don’t think there’s any way around
it. I would reccomend following Dan Benjamin’s phenomenal step by step
directions here:
and run it that way. It will return as 1.1.6 from shell, but do a gem
list to verify you’re on edge.
soho:~ jathayde$ rails -v
Rails 1.1.6
and you’ll see “1.1.6.5618” as the version number.
soho:~ jathayde$ gem list
*** LOCAL GEMS ***
actionmailer (1.2.5.5618, 1.2.5)
Service layer for easy email delivery and testing.
actionpack (1.12.5.5618, 1.12.5)
Web-flow and rendering framework putting the VC in MVC.
actionwebservice (1.1.6.5618, 1.1.6)
Web service support for Action Pack.
activerecord (1.14.4.5618, 1.14.4)
Implements the ActiveRecord pattern for ORM.
activesupport (1.3.1.5618, 1.3.1)
Support and utility classes used by the Rails framework.
rails (1.1.6.5618, 1.1.6)
Web-application framework with template engine, control-flow layer,
and ORM.
Drew, Agile v2 requires edge/1.2. I don’t think there’s any way around
it. I would reccomend following Dan Benjamin’s phenomenal step by step
directions here:
Bob -
Thanks for the help thus far. I do indeed now have Raisl edge/1.2
installed. However I am receiving the very same error I first discussed.
Here’s my full trace: