search for: session_duration

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

2005 Oct 28
4
find_by_sql column types
...hat 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 to_f conversions because type coercions are not happening as I would have expected. Again, for example: foo = MyDomain.find_averages(1) bar = foo[:latency] / 3.0 # fails because foo[:lat...