I am working on allowing users to input measurements into a field and many will have fractions (eg. 3 5/6, 1/2, 4). Some user entries will just be a Fixnum.

The db table should store all user entered numbers as a integer by multiplying by 12 (eg 3 5/6 => 46, 1/2 => 6, 4 => 48).

How would I go about taking a user entry and converting it to the "entry" x 12 integer for the db?

Many thanks.