Displaying 1 result from an estimated 1 matches for "live_log".
Did you mean:
give_log
2005 Oct 28
4
find_by_sql column types
...ns 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[:latency] is a str...