Reputation: 1314
Im trying to assign custom classes to my simple_form elements to modify with CSS and its just not working.. following the documentation, something like
<%= f.input :username, :input_html => { :class => 'special' } %>
Should work but does not...
Any clues? Thanks!!!
PS- This line is in a nested "f.simple_fields_for"
Upvotes: 0
Views: 665
Reputation: 7510
if you are embedded in a fields_for
then it should be
<%= simple_for_object @object do |f| %>
<%= f.simple_fields_for :fields do |field| %>
<%= field.input :username, :input_html => {:class => 'special'} %>
<% end %>
<% end %>
I normally use haml, so my erb might be a bit off. but the idea is that if you are in a fields_for
block you need to use the block variable of that block and not the variable for the parent form's block.
Upvotes: 1