What I am trying to do is create partial that will be invoked by
a :show_product action under the :admin controller.
This partial is meant to have a list of categories and checkboxes next
to each category. I want to set it up so when someone checks/unchecks
a category, it does something like category.products < self
The models for both Category and Product have a hmabt relationship w/
The code I’ve got so far is:
<%= render :partial => “categories”, :product => @product %>
<% if @categories %>
<% for category in @categories %>
<% else %>
No categories found.<% end %>
@categories = Category.find(:all)
The output from currently is:
- How do I set up an observe_form or observe_field so that if someone
clicks on the a checkbox, it calls the action :update_product_category
and passes it the parameter of @product.id and category.id?
- Why does the check_box code also produce a hidden field? If I remove
the check_box code, it doesn’t produce the hidden field any more.
- What’s up with the authenticity_token?