Forum: Ruby on Rails Error running rake db:test:prepare

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3d33a37551176d96ec270d4e4d6c843b?d=identicon&s=25 Keith Litwin (keith74)
on 2008-11-04 05:12
Hey all,

I am getting syntax errors in my schema.rb when I run rake
db:test:prepare.  In my migrations, I have created columns that look
like this...

add_column :prizes, :"paypal_amount", :decimal, :precision => 8, :scale
=> 2, :null=>false, :default=>0

and this works fine and creates the column correctly in the DB.  The
corresponding line in schema.rb that gets created looks like this (the
paypal_error column is shown for context)...

....
t.column "paypal_amount", :decimal, :limit => 8, :default =>
#<BigDecimal:43fac10,'0.0',4(8)>, :null => false
t.column "paypal_error", :string

Now when I run rake db:test:prepare, I get errors like the following..

C:/InstantRails-2.0-win/rails_apps/chicago/db/schema.rb:93: syntax
error, unexpe
cted ',', expecting kEND
    t.column "paypal_error", :string

It seems that the "BigDecimal" syntax that rails creates in schema.rb is
not correct, but I'm not sure if I did something wrong or if this is a
bug.  I tried recreating schema.rb running rake db:schema:dump, but it
did not help.  I'm running Rails 2.1.1 with postgres 8.3.1.

Any help is appreciated.

Thanks,
Keith
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2008-11-04 12:31
(Received via mailing list)
On Nov 4, 4:12 am, Keith Litwin <rails-mailing-l...@andreas-s.net>
wrote:
> corresponding line in schema.rb that gets created looks like this (the
> paypal_error column is shown for context)...
>
> ....
> t.column "paypal_amount", :decimal, :limit => 8, :default =>
> #<BigDecimal:43fac10,'0.0',4(8)>, :null => false
> t.column "paypal_error", :string

It's definitely that default which is wrong. Probably something bust
with the schema dumper.

Fred
This topic is locked and can not be replied to.