I have two models - Client
& Topic
, with a HABTM relationship between them.
I am trying to generate a series of checkboxes of the topics, on the Client form
partial.
This is what I am doing:
<% Topic.all.each do |topic| %>
<% checked = @client.topics.include?(topic) %>
<%= f.label(:name, topic.name) %> <%= f.check_box @topics, topic.id %>
<% end %>
This is the error I get:
undefined method `merge' for 1:Fixnum
I know one solution is to use check_box_tag
, but that forces me to do the record updating of the associations manually.
So I would rather use the form_helper for the checkbox tag. The docs are a bit confusing to me.
How can I get this to work with f.check_box
.
Thanks.