Search Results

Search found 1 results on 1 pages for 'daz13'.

Page 1/1 | 1 

  • How to set up two models having a has_many association with each other

    - by daz13
    I'm looking for a suggestion on how to set up two models, Teacher and Subject. A Teacher can have many Subjects, and a Subject can have many Teachers. Another thing to consider in the relationship between the two models is that a Teacher can create a Subject and add other Teachers to the Subject. I think I'm solid on the basics of the set up for each model: for teacher.rb: has_many :subjects for subject.rb: has_many :teachers and the teachers table should have a subject_id column and the subject table should have a teacher_id column. What I'm not sure about is how to set up the views (and corresponding controller methods) to allow the addition of a Teacher to a Subject. Any suggestions (or links to examples) are greatly appreciated. I haven't been able to find anything on this exact case.

    Read the article

1