Lets say I have two databases: one for students and one for classes. I would like to be able to \'add\' classes to a specific student and also be able to add students to a
This is an old question, but just in case anyone stumbles upon this like I did, you can now have the relationships has_and_belongs_to_many
. So yes, you would create a join table:
create_join_table :students, :courses do |t|
t.integer :student_id
t.integer :course_id
end
And then in the models, you would say that a student has_and_belongs_to_many :courses
And a course has_and_belongs_to_many :students
. There is no need to make a third class called CourseStudent. This link has all this information