Reputation: 365
I am using the ransack gem with a rails 4 application, and would like to incorporate bootstrap classes into the search_form_for. This is what my select currently looks like.
<%= c.predicate_select ({only: [:cont, :not_cont, :eq, :not_eq, :blank, :null, :not_null]})%>
I've also tried passing in a second hash with html options like so (per the documentation):
<%= c.predicate_select ({only: [:cont, :not_cont, :eq, :not_eq, :blank, :null, :not_null]},{class=>'form-control'})%>
Clearly I'm doing something wrong. Anyone have any suggestions as to how to properly apply a class to the ransack predicate_select ?
Upvotes: 2
Views: 2261
Reputation: 1292
That is weird. When I call
<%= c.predicate_select({only: [:cont, :not_cont]}, {class: 'my_class'}
I get
<select class="my_class" id="q_p" name="q[p]" style="display: none;">...</select>
You have a typo in your code sample (...,{class=>'form_control'}
), but I suspect that is not the cause of this problem?
Upvotes: 3