That's a common ruby gotcha.  Division of integers results in an integer.  To 
fix, convert one or both numbers to floats with .to_f or include a decimal 
place on the literal (e.g., 3.0/2)

HTH,

-Roy

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Joshua Muheim
Sent: Friday, October 17, 2008 2:13 PM
To: [email protected]
Subject: [Rails] 3 / 2 is 1?


Hi all

Why is 3/2=1 in a Rais view? How can I get Rails to output 1.5 as the result?

Thanks
Josh
--
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to