Is it possible to do Rails calculations like average on encrypted fields?
Answer.average(:encrypted_value)
Or do you need to retrieve all values and then calculate the average in Ruby?
answers = Answer.all.map{|a| a.value.to_i}
answers.sum.to_f / answers.size.to_f
This obviously isn't very efficient so wondering if there's a better option.
Should I consider dropping the encryption? Any guidance would be greatly appreciated! 🙏