One to Many Tables Problem
I have a person table and a membership table. One person can have many membership entries in the membership table which has an id as primary key and person_id as foreign key. In the person.rb I have "belongs_to :membership" and in the membership.rb I have "has_many :people". In the controller edit method, I want to get all rows from the membership table where person_id = id of the person table. The syntax I have is
but this does not work - can you help me with this syntax?
@membership = Membership.find(:all, :conditions => [ "person_id = ?", params[:id]])
Second, once I have a membership object, how do I iterate through the object to display the various rows of the membership table?