I think you can use @quiz variable by making it a class variable as
@@quiz or a global variable $quiz.
Certainly, a wrong way to do it. Don’t do it (at least in rails controller)
As suggested earlier, you should pass ids in params or store in session to retrieve in your check_answer method.