Hi all,
is just my fault.. or I can't write an having caluse for a group in a
named scope? °_°
i.e.
named_scope :last_year_best_buyers, :joins => :invoices, :conditions
=> {"invoices.closed" => true, "invoices.issued_on" =>
1.years.ago..Date.today}, :group => "customers.id", :having => "SUM
(invoices.taxable_income) > 15000"
Calling Customer.last_year_best_buyers, leads to a:
ArgumentError: Unknown key(s): having
How can I specify an having clause (the only way I know to filter
results using aggregate functions, ain't it)?
thanks
G.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---