I'm struggling a bit with understanding default scopes and named scopes with my quiz application. I'm on rails 3.0.
I have a Question
model that has_many
UserResponse
models.
Question
has the question text
and possible answer_ids
. UserResponse
ties user_id
to a question_id
and answer_id
.
When I find()
a Question
to display to the user, I don't want to also pull every single UserResponse
. By default, I'd like to only pull the UserResponse
for the current user_id
to see if they have already answered this question.
How can I create a scope on either the Question
or UserResponse
to accomplish this?