I might (still) be thinking about this in the wrong way, but I'm hitting an error that says
"Couldn't find Quiz with 'id'=39"
The line that generates this error is:
if (Quiz.find(current_user.id)) ...
I think there are 2 problems with this code:
1) The Quiz table has a user_id column that associates it with a User, but I'm (unintentionally) looking for the ID of the quiz.
2) The Quiz never gets instantiated so, even if I looked for the user_id attribute in Quiz, there would be no Quiz to find.
I'd like to know where in my Rails code I should create the Quiz in the first place. Is this something that should happen when a User is created? If so, should the Quiz be instantiated 'in' a @quiz variable in User? And in which method? new? build? initialize? create?
This instantiation, I assume, would need to include setting the new Quiz's user_id to the current_user.id, so I don't see how that can happen in the model, before current_user is even accessible.
Any clues, much appreciated.
has_one :quiz and Quiz