more on ActiveRecord Calculations

Well, everyone that saw my Calculations plugin had the same thing to say: the higher order methods suck. Passing the group by and having values as options is closer to the established find() method signature. Let this be a lesson to any API designers: go for familiarity and conventions over clever tricks.

It also made the library simpler and shorter. Why do I like to make things difficult?

If you've already been using it, change your method calls from:

Order.calculate(:sum, :cost).group_by(:country).having { |x| x > 75 }

to

Order.calculate(:sum, :cost,
  :group => :country,
  :having => 'sum(cost) > 75')

If you live life on the rails edge, here's how to install it:

ruby script/plugin install http://techno-weenie.net/svn/projects/calculations