search for: domain_average

Displaying 1 result from an estimated 1 matches for "domain_average".

2005 Oct 28
4
find_by_sql column types
Hello-- There must be a better way to do this. I have a class method in my model that finds averages and does a few calculations using find_by_sql. The problem I¹m encountering is that all computed columns from MySQL come back as type string. E.g., def self.find_averages(domain_id) if @@domain_average return @@domain_average else @@domain_average = MyDomain.find_by_sql(["select avg(latency) as latency, avg(datediff(session_end, session_start)) as session_duration from live_logs where domain_id=?"], domain_id])[0] end end The problem is that I¹m using a lot of t...