Displaying 1 result from an estimated 1 matches for "avg_thevalu".
Did you mean:
avg_thevalue
2008 May 27
2
order complex aggregation results in 'calculate'
...#39;'calculate'' (from ActiveRecord::Calculations::ClassMethod)?
I have a "legacy" table from which I would like to retrieve some
aggregated data, with an ordering. Something like:
Entry.calculate(''avg'', ''thevalue'', { :order=> ''avg_thevalue DESC'' })
which generates the following (Postgres) query:
SELECT avg(subject) AS avg_subject FROM logevents ORDER BY
avg_subject
This works, but the :order option depends on what I think are
implementation details of the function calculate: namely the
generation of the "AS avg_s...