I am using the Money gem and composed_of as per this answer: https://stackoverflow.com/a/3843805/4162458
I have an integer column in my database, :discount
product.rb
class Product < ActiveRecord::Base
composed_of :discount_display,
:class_name => 'Money',
:mapping => %w(discount cents),
:converter => Proc.new { |value| Money.new(value) }
And in my form:
<%= f.number_field :discount_display, class: 'form-control', min: "0" %>
However, if I enter 12, it saves in the database as 12 and displays on the form when I refresh as 0.12.
How can I have it so that when you enter "12" it is saved as 1200 in the db and displays properly, as that answers seems to say should happen?