Ruby on Rails Sunday, April 6, 2014

I am trying to list all the categories a user can be interested in with check boxes so that a user can submit these interests through my join table.

collection_radio_buttons works with a simple has_many, belongs_to association:

<%= collection_radio_buttons(:listing, :category_id, Category.all, :id, :name do |b| %>
     <%= b.label { b.radio_button} %>
     <%= b.text %>
<% end %>

I am not sure how to go about this so that I can get all the categories from it's model and write the corresponding id's to the join table?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/50938de6-5dd8-4ab1-acf8-348458b23c8d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment