On Thu, Nov 12, 2009 at 2:06 AM, pauld <paul.denlin...@gmail.com> wrote:
> > Here you go: > > class AddPriceToProduct < ActiveRecord::Migration > def self.up > add_column :products, :price, :decimal > :precision => 8, :scale => 2, :default => 0 > It seems that you have missed a comma after the field type (i.e. decimal) and it should be implemented as follows: add_column :products, :price, :decimal, :precision => 8, :scale => 2, :default => 0 Thus, the migration should look as follows: class AddPriceToProduct < 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 Good luck, -Conrad > end > def self.down > remove_column :products, :price > end > end > > On Nov 12, 4:16 pm, Franz Strebel <franz.stre...@gmail.com> wrote: > > Can I see what's in 20091112074628_add_price_to_product.rb ? > > It says there's a syntax error in your migration. > > > > > > > > On Thu, Nov 12, 2009 at 9:12 AM, pauld <paul.denlin...@gmail.com> wrote: > > > > > Am having trouble with rake file, but can't find problem. Can you > > > help? Haven't been able to understand the error message returned. > > > > > Thank you. > > > > > > --------------------------------------------------------------------------- > ------ > > > > > Macintosh:depot pdenlinger$ rake db:migrate > > > (in /Users/pdenlinger/Sites/depot) > > > rake aborted! > > > ./db/migrate//20091112074628_add_price_to_product.rb:4: syntax error, > > > unexpected tASSOC, expecting kEND > > > :precision => 8, :scale => 2, :default => 0 > > > --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---