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 Development 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
On Aug 2, 2006, at 8:37 AM, Dark Ambient wrote:> == 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:Are you running Edge Rails? You need it for decimal support Dave
Thanks Dave, I am not but can set it up for Depot. I forgot that you had mentioned it prior. Stuart On 8/2/06, Dave Thomas <dave@pragprog.com> wrote:> > On Aug 2, 2006, at 8:37 AM, Dark Ambient wrote: > > > == 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: > > > Are you running Edge Rails? You need it for decimal support > > > Dave > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >