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 ;) ) class Movie < ActiveRecord::Base has_many :localdetails has_many :territories, :through=>:rights end class Territory < ActiveRecord::Base has_many :localdetails has_many :movies, :through=>:rights end class LocalDetail < ActiveRecord::Base belongs_to :movie belongs_to :territory end 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 movie_id=?',territory.id,@movie.id]) check_box('movie[localdetail_id]','will_be_shown_here') end 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 ?
on 2006-06-09 20:32