I ran a migration with the following: create_table :userlevels do |t| # t.column :name, :string t.column :usertype, :string, :limit => 15 t.column :userlevel, :string, :limit => 15 t.column :price, :decimal, :precision => 7, :scale => 2 end The problem is the decimal column. rake ignored the precision and scale parameters and defined it as decimal(10,0). What''s the magic words to actually get rake to create a decimal column with decimal places? I''m sure it''s obvious, but I don''t see it. Thanks in advance ---Michael -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The column type :decimal didn''t work in my installation, so I worked around it with a plain MySQL statement in the migration script instead of your t.column statement: t.column :price, :float execute "alter table products modify column price decimal(8,2)" Michael Satterwhite wrote:> I ran a migration with the following: > > create_table :userlevels do |t| > # t.column :name, :string > t.column :usertype, :string, :limit => 15 > t.column :userlevel, :string, :limit => 15 > t.column :price, :decimal, :precision => 7, :scale => 2 > end > > The problem is the decimal column. rake ignored the precision and scale > parameters and defined it as decimal(10,0). What''s the magic words to > actually get rake to create a decimal column with decimal places? I''m > sure it''s obvious, but I don''t see it. > > Thanks in advance > ---Michael-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thanks man, that did the trick ! Simple. Groetjes -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 10/6/06, Michael Satterwhite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I ran a migration with the following: > > create_table :userlevels do |t| > # t.column :name, :string > t.column :usertype, :string, :limit => 15 > t.column :userlevel, :string, :limit => 15 > t.column :price, :decimal, :precision => 7, :scale => 2 > end > > The problem is the decimal column. rake ignored the precision and scale > parameters and defined it as decimal(10,0). What''s the magic words to > actually get rake to create a decimal column with decimal places? I''m > sure it''s obvious, but I don''t see it.You need to be running edge rails. Decimal support isn''t included in the stable release. Isak> > Thanks in advance > ---Michael > > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---