Has_many / : through / check_box - update problems


Can anyone help me with this, which has been making me tear my hair out
for 2
days now ?

I have the following classes using has_many :through relationships…
(I’ve changed the class names to make it easier to understand, so don’t
beat me up about naming conventions :wink: )

class Movie < ActiveRecord::Base
has_many :localdetails
has_many :territories, :through=>:rights

class Territory < ActiveRecord::Base
has_many :localdetails
has_many :movies, :through=>:rights

class LocalDetail < ActiveRecord::Base
belongs_to :movie
belongs_to :territory

The tables contain the usual *_id fields, and all display correctly,
so no need to worry there.
Localdetails contains extra info, including a “will_be_shown_here” field

I’ve got code that makes sure that for every Movie-Territory pair, there
is a record in the localdetails table

While in a Movies controller, I want to loop through each Territory and
display a line which allows editing of the localdetails for that Movie
for each Territory, something like…

for territory in @territories
localdetail=LocalDetail.find(:all, :conditions[‘territory_id=? AND


But I can’t find any form of syntax for the checkbox that will allow
this to work.

I think I’ve tried everything, but of course, you may know better…

Any ideas ?