I have a collection select:
<%= f.collection_select :role, User::ROLES, :to_s, :humanize %>
What is the radio button for this method?
Thanks
There is no such helper in Rails 3. In Rails 4, it is collection_radio_buttons.
This way..
<%= f.collection_radio_buttons :role, User::ROLES %>
No documentation found for the form builder, but this should work:
<%= f.collection_radio_buttons :my_attribute, my_hash.map {|k,v| [k,v]}, :first, :last do |b| %>
<div class='my-class'>
<%= b.radio_button %>
<%= b.label %>
</div>
<% end %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With