Hi,, Newby question... I want to store percents, what kind of column type must i use in my migration file?? remco -- 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 20, 2007, at 1:49 AM, Remco Swoany wrote:> Newby question... > > I want to store percents, what kind of column type must i use in my > migration file??That would be either integer or decimal, but the choice would really depend on how you intend do do the calculations using those numbers. Do you want to do them as 150 x 0.75 to represent 75%, or do you want to do them as 150 x (75/100) to represent 75%. The former is more comvenient for calculations, but less convenient for displaying (since most people want 75 and not 0.75 for display purposes). The latter is the opposite. So, you pick which version, and choose a columne type that is suitable. -- gw (www.railsdev.ws) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Is this for a class? If so, I''m quite jealous :) Anyhow, I suggest decimal/real as it will be more expedient for coding purposes. If the output is weird, like: rate: 0.3333333333333333333 when the desired output is: rate 33% I would call that a minor issue and move on to something else, then fix it later with some formatting. -thufir --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---