Is it possible to specify the length and number of decimal places for a float in a migration? I using MySQL and can do it through the GUI client, but can''t Google up anything on doing it in a migration. Thanks, Bill --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You should use decimal instead of float. t.column :name, :decimal, :precision => 10, :scale => 2 This will give you numbers as 00000000.00, for example (10 digits, 2 digits right of decimal point). Regards, Jorge Corona. On Sep 10, 6:35 pm, "Bill Walton" <bill.wal...-xwVYE8SWAR3R7s880joybQ@public.gmane.org> wrote:> Is it possible to specify the length and number of decimal places for a float in a migration? I using MySQL and can do it through the GUI client, but can''t Google up anything on doing it in a migration. > > Thanks, > Bill--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Jorge, Pozole wrote:> You should use decimal instead of float. > > t.column :name, :decimal, :precision => 10, :scale => 2Perfect. Thanks much! Best regards, Bill --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---