not showing correct values for fields with composed_of (money) #645

Closed
ilyakatz opened this Issue Aug 6, 2011 · 3 comments

Comments

Projects
None yet
2 participants

ilyakatz commented Aug 6, 2011

i have a model that uses money gem to treat one of the fields as money, with the following definition

composed_of :default_rate,
:class_name => "Money",
:mapping => [%w(default_rate cents), %w(currency currency_as_string)],
:allow_nil=>false,
:converter => :convert_to_money

so in database the value would be 1500 to represent $15.00

however, when i use semantic_form_for, it seems that form displays the value that is in database (1500) which is not correct. do you mind if append the wiki to give a suggestion on how to correctly show money values with semantic_form_for?

Owner

justinfrench commented Aug 7, 2011

Sure thing @ilyakatz, no permission needed there, although please make sure I've seen what you contribute, because it might help me think of a way to support this in the app by default. will close this for now since there's no code change at this point.

Owner

justinfrench commented Aug 9, 2011

Perfect. With Formtastic 2 I would recommend :as => :money with a new MoneyInput (probably subclassing NumberInput?). Have added an issue for 2.1 or beyond #649.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment