Problem with a calculation as an action

Why does this give me the error "undefined method `-' for" as an action
in a controller but works fine as a helper?

count = values.size
mean = values.inject(:+) / count.to_f
stddev = Math.sqrt( values.inject(0) { |sum, e| sum + (e - mean) ** 2 }
/ count.to_f )

Why does this give me the error "undefined method `-' for" as an action
in a controller but works fine as a helper?

Is values the same in both cases (what is it)? What is the type of the object upon which - can't be called?

I solved it. The values where strings not integers.