Forum: Ruby on Rails Architecture/model related question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
9cfde8cbd74e3fb79d41cba817f5d7b8?d=identicon&s=25 Melvin Ram (melvinram)
on 2008-11-24 18:25
(Received via mailing list)
I've currently got 3 models: User, Lesson and Course

The associations are:
* Lesson belongs_to Course
* Course has_many Lessons

* Course belongs_to User
* User has_many Courses

Now I'm adding a new model for LessonCompletion, which will be
used to track which lessons the user has completed and when.

LessonCompletion belongs_to Lesson
LessonCompletion belongs_to User

User has_many LessonCompletions
Lesson has_many LessonCompletions

Now the way that this model (LessonCompletion) will be used is
primarily
on the Course show page in displaying which lessons are done.

My question is, should I add another association of LessonCompletion
belongs_to Course,
Course has_many LessonCompletions or should I just go with
Course has_many LessonCompletions, :through => :lessons ?

The reason I ask is because I'm wondering if the :through will be very
taxing on the system as it will get used a lot.
This topic is locked and can not be replied to.