I've upgraded simple_form from 2.1.0 to 3.0.3 (yes, still pretty old) and Rails from 3.2.22 to 4.2.10, and it seems like as a result, I've lost it setting for textarea
elements associated with a text
column a default of cols
being 40, and rows
being 20. Now it doesn't seem to set any values for cols
and rows
.
Is it possible to configure simple_form to set cols and rows for textarea
for text
application-wide? Or do I have to set something like
<%= f.input :message, input_html: {cols: 40, rows: 20} %>
for every input in the application?
I tried searching the simple_form github repo, and there's only three mentions of input_html in their wiki, none of which addressed this issue.
Simple Form offers an easy way to change the default behaviour (v3.0.3) by redefining existing Simple Form inputs. This is done by creating a new class with the same name. For instance, if you want to set default rows and cols, you can do:
# app/inputs/text_input.rb
class TextInput < SimpleForm::Inputs::TextInput
def input
input_html_options[:cols] ||= 40
input_html_options[:rows] ||= 20
super
end
end