Reputation: 8587
I have a collection select:
<%= f.collection_select :role, User::ROLES, :to_s, :humanize %>
What is the radio button for this method?
Thanks
Upvotes: 5
Views: 4844
Reputation: 34013
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 %>
Upvotes: 1
Reputation: 12320
This way..
<%= f.collection_radio_buttons :role, User::ROLES %>
Upvotes: 2
Reputation: 5294
There is no such helper in Rails 3. In Rails 4, it is collection_radio_buttons.
Upvotes: 7