I\'m trying to make a custom input for currency in my app. I had those bootstrap wrappers and etc (I think it comes with simple_form or with bootstrap gem...), so, I could do so
That block variable is not existent, your input method have to be like this:
class CurrencyInput < SimpleForm::Inputs::Base
def input
input_html_classes.unshift("string currency")
input_html_options[:type] ||= input_type if html5?
template.content_tag(:span, "$", class: "add-on") +
@builder.text_field(attribute_name, input_html_options)
end
end
Now you can register a default wrapper to this custom input in you Simple Form initializer:
config.wrapper_mappings = { :currency => :append }
An you can use like this:
<%= f.input :cost, :as => :currency %>