Hi, What do you guys use to definitely handle decimal numbers? This is getting me crazy! I use BigDecimal, but it craps out of the input number is something like "14,53", Rails transforms it as 14.0 Any solution? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> What do you guys use to definitely handle decimal numbers? This is > getting me crazy! > > I use BigDecimal, but it craps out of the input number is something like > "14,53", Rails transforms it as 14.0 > > Any solution?Are you really using the comma in the data? This IRB session suggests what might be happening (unless there''s a en ENV flag that allows the comma?):>> require ''bigdecimal''=> true>> x = BigDecimal=> BigDecimal>> x = 14.4564=> 14.4564>> x = 14,4564=> [14, 4564]>>-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
It seems Rails does it a bit differently. Anyway I was able to find a solution: http://gem-session.com/2010/03/how-to-use-the-comma-as-decimal-separator-in-rails-activerecord-columns-and-text-fields -- http://digiprof.tv -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe Matching Threads
- Decimals are being converted to Bigdecimals!!!!!
- question about activerecord test_numeric_fields in base_test.rb
- any tricks re using " eql(5.5)", but where 5.5 is a decimal not float?
- Float -> BigDecimal
- Financial app - decimal to float conversion problem