not sure what @person.quizzes refers to [so this might not apply here] but
if it refers to an ActiveRecord association you could use the sum method in
ActiveRecord like @person.quizzes.sum(:some_field). link with more details:
http://api.rubyonrails.org/classes/ActiveRecord/Calculations/ClassMethod
Re: #1--you want to call either .to_i or .to_f on your now-string variables.
The former converts to integer, the latter to a floating point number.
Also (and read this next bit w/the voice of the Simpson's Comic Book Guy in
your head) there is no compiler--ruby is an interpreted language, it h
2 matches
Mail list logo