In my controller's show method, I am having trouble creating an instance variable for each 'Subject' in my database. The "@pie_correct" variable works, but the problem is in the ".each" loop - I get the error "syntax error, unexpected '=', expecting keyword_end" How should I change this?
@pie_correct = TestQuestions.where(:correct => true).joins(:test).merge(Test.where(user_id: current_user))
Subject.all.each do |s|
"@subject_ + #{s.id} + _correct" = @pie_correct.joins(:question).merge((Question.all).joins(:subject).merge(Subject.where(id: s.id)))
end
Thanks.