class CurrencyInput < SimpleForm::Inputs::Base include ActionView::Helpers::NumberHelper def input input_field = @builder.text_field(attribute_name, input_html_options) end def input_html_options merge_formatted_value(super) end private def merge_formatted_value(hash) if object.errors[attribute_name].empty? hash[:value] ||= number_to_currency(object.send(attribute_name)) end hash end end