Topic: how to set the value of my checkbox?

hey all,
I'm have a HABTM relationship and I'm trying to use checkbox.
The problem is that I can't set the value of each checkbox sad each checkboth value gets set either to 1 or 0 depending on whether the it is checked or not. I would like the value to be equal to the id of my model.
This is how I do it:

<% for cat in @categories %>
<p><b><%= cat.name%></b> <br />
<% for forum in cat.forums %>
<%= check_box(:forums, :id ,:value=>forum.id, :checked => (forum.users.include? @user) ? 'checked' : false  ) %><%= forum.forum_name %> <br />

<% end %>
</p>
<% end %>


I also tried without the :value=>forum.id but still nothing

Any idea?

thanx in advance

Pat

Re: how to set the value of my checkbox?

You may want to try check_box_tag instead. However, you will still have the problem with clashing field names which will override each-other resulting in only one checkbox field being sent. If you do a search on this forum you should find a couple posts on how to do HABTM with checkboxes. There's also one on the rails wiki I think.

Railscasts - Free Ruby on Rails Screencasts