RoR: Condition Always False - Why?
- by Matt Hollingsworth
Working in RoR 2.3.x. My quiz_results table has a row for user_id (3907) and result (0.1), and two users I'm looking at with no rows in the quiz_results table. This line keeps returining false:
-if QuizResult.find_by_user_id(@user_id).present?
But if I change it to anything that returns true, the next line reports an error on the * method:
="#{(QuizResult.average('score', :conditions => 'user_id = #{@user.id}') * 100).round}%"
The beginning of the code is a loop:
[email protected] do |user|
Any ideas how to fix? Have tried unsuccessfully all day.