views:

61

answers:

0

Hello I'm using ryan Bates railscast on HABTM checkboxes.... I looking for the way to call a specific record from the set, allow me to explain.

In my view I have

 <% for interest in Interest.find(:all) %>
 <div>
 <%= check_box_tag "user[interest_ids][]", interest.id, @user.interests.include?(interest) %>
 <%= interest.name %>
 </div>
 <% end %>

Which does a great job of finding the entire list of interests and providing checkboxes as well...Now I would like to query specific interests from my Interest model, and the find(:all) will no longer work.

How could I do that? I was thinking something like Interest.find(3) but how can I do this without the for loop and where would the find(3) part go?

Anyone know where I can tell it to give me the checkbox and interest.name for a specific id??