So I have a custom query that I embedded into a class method
find_by_sql(["SELECT SUM(distance * 0.000621371192) as sum FROM
reports WHERE unit_id=? AND id >= ? AND id <= ?", unit_id, report1,
value = Report.get_sum_for_range(unit.id,report1,report2)
The problem is value will be a report object that contains an
attribute called sum with the value, but all I want is just the value
itself returned into value.
thanks for response