Topic: Feedback on my model structure and One-Way has_many :through
I've asked similar questions before here, but I've been learning a ton since I last asked about this and have revised my app's structure considerably.
Anyways, I have an app for taking classes online. Currently, here is my structure (the relevant parts anyways):
User has_many :subscriptions has_many :courses, :through => :subscriptions Course has_many :subscriptions has_many :users, :through => :subscriptions
I'm working on adding the Exam and Grading parts of the app and am currently working with this for my model associations:
User # all of above has_many :grades, :through => :subscriptions Course # all of above has_many :lessons Grade belongs_to :lesson belongs_to :user # this is the part that gets kind of hairy; should this belong to :subscriptions or :users Lesson has_one :grade belongs_to :course # this also seems weird, but it's necessary that a lesson is related to Course for sure has_many :questions Question has_many :answers has_one :correct_answer # a pseudo-model based on answers with the correct boolean set to 'true' belongs_to :lesson Answer belongs_to :question
What do you guys think? Especially about the Grade model. How's the proper way to express a one-way has_many :through association?