In a Rails app, we would like to specify both rows and value for a text column in simple form. It is easy to do with one:
<%=f.input :column, :input_html => {:rows => 5}%>
<%=f.input :column, :input_html => {:value => 'abc'}%>
We tried the following for 2 attributes:
<%=f.input :column, :input_html => {:rows => 5, :value => 'abc' }%>
Only the :value works and there is only single row instead of 5. The following causes syntax error:
<%=f.input :column, :input_html => {{:rows => 5}, {:value => 'abc' }}%>
What's the right way to specify 2 attributes in input_html? Or it is not achievable?
UPDATE: Here is the html source for the text column:
<div class="input string optional onboard_engine_config_argument_value"><label class="string optional control-label" for="onboard_engine_config_argument_value">变量值</label><input class="string optional span12" id="onboard_engine_config_argument_value" name="onboard_engine_config[argument_value]" rows="5" size="50" type="text" value=" ....."</div>
The value = "..." is a extremely long text which is a html.erb file and is displayed not in its original order. We are trying to make it displayed in its original order.
The reason it doesn't seem to work is because simple_form generates an input instead of a textarea. To force it to render a textarea do it like this.
<%= input :column, input_html: { rows: 4, value: "some long text"}, as: :text %>
The as: :text
part forces it to render a textarea.