I am getting the same thing. Dave Thomas is saying you need to be
running Rails 1.2.1 for this to work properly or Edge Rails.
I am running Rails 1.2.1 and I still get the error. It appears the
problem lies with how Rails is interpreting :decimals.
I am still looking for the fix for this. If I find it, I will post it
here.
On Jan 14, 4:13 pm, "Lovell"
<lovell.mcilw...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hello all,
>
> I am running into an issue where I am trying to do a db:migrate after
> adding a price column to my database. Can anyone tell me what I can do
> to fix this... I''m trying to learn this so my debugging skills
aren''t
> so great.
>
> I have done the following:
>
> 1. [lmcilwain@Blade2 ~/depot]$ ruby script/generatemigrationadd_price
>
> 2. Edited the file:
> ===================> [lmcilwain@Blade2 ~/depot]$ vi
/db/migrate/002_add_price.rb
>
> Added the following lines:
>
> class AddPrice < ActiveRecord::Migrationdef self.up add_column
> :products, :price, :decimal, :precision => 8, :scale => 2, :default
=>
> 0 end def self.down remove_column :products, :price end end
> ===================>
> 3. [lmcilwain@Blade2 ~/depot]$ rake db:migrate
>
> (in /home/lem/depot)
> == AddPrice: migrating
> =======================================================> --
add_column(roducts, rice, :decimal, {recision=>8, :scale=>2,
> :default=>0})
> rake aborted!
> You have anilobjectwhen you didn''t expect it!
> You might have expected an instance of Array.
> Theerroroccured while evaluatingnil.[]
>
> (See full trace by running task with --trace)
>
> [lmcilwain@Blade2 ~/depot]
>
> Here is what I got when I ran the trace:
>
> C:\Documents and Settings\Administrator\work\depot>rake db:migrate
> --trace
> (in C:/Documents and Settings/Administrator/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 anilobjectwhen you didn''t expect it!
> You might have expected an instance of Array.
> Theerroroccured while evaluatingnil.[]
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_
> adapters/abstract/schema_statements.rb:259:in `type_to_sql''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connection_
> adapters/abstract/schema_statements.rb:122:in `add_column''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:273:in `method_missing''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:257:in `say_with_time''
> c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:257:in `say_with_time''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:271:in `method_missing''
> ./db/migrate//002_add_price.rb:3:in `real_up''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:210:in `migrate''
> c:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:210:in `migrate''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:333:in `migrate''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:328:in `migrate''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:295:in `up''
>
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/migration.r
> b:286:in `migrate''
> c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/tasks/databases.rake:4
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
`execute''
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in
`execute''
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in
`invoke''
> c:/ruby/lib/ruby/1.8/thread.rb:135:in `synchronize''
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in
`invoke''
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in
`run''
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in
`run''
> c:/ruby/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7
> c:/ruby/bin/rake.bat:25
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---