<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>I.NFECTIO.US: ActiveRecord Calculations</title>
    <link>http://i.nfectio.us/articles/2006/11/05/activerecord-calculations</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>"Nothing in life is worth doing if you have no life while doing it"</description>
    <item>
      <title>ActiveRecord Calculations</title>
      <description>I've been wanting to modify the ActiveRecord Calculations module to support multiple aggregate calculations in one query for awhile now. My current project with lots of graphing finally gave me the motivation to do it. Refer to the patch for details and feel free to comment on it.

&lt;pre&gt;
# Calculate different aggregate functions at once
min, max = Person.calculate(:min, :age, :max, :age)

# Specify the column aliases so you can order by it
views, replies = Posts.sum({:views =&gt; 'number_of_views'}, :replies, :order =&gt; "number_of_views desc") 
&lt;/pre&gt;

&lt;a href="http://dev.rubyonrails.org/ticket/6552"&gt;Multiple Calculations Patch&lt;/a&gt;
&lt;br /&gt;&lt;br /&gt;</description>
      <pubDate>Sun, 05 Nov 2006 12:38:00 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:f9e40c1f-0b94-48a4-81b7-d04a0f9475cd</guid>
      <author>Bob Silva</author>
      <link>http://i.nfectio.us/articles/2006/11/05/activerecord-calculations</link>
      <category>Ruby on Rails</category>
      <category>rails</category>
      <category>patch</category>
      <category>calculations</category>
    </item>
    <item>
      <title>"ActiveRecord Calculations" by Eric</title>
      <description>Hi!

Is this still possible to use this patch with Rails 1.2?</description>
      <pubDate>Thu, 01 Mar 2007 04:22:26 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:a75708fc-352b-41d9-8307-02fb70c2cd13</guid>
      <link>http://i.nfectio.us/articles/2006/11/05/activerecord-calculations#comment-266</link>
    </item>
    <item>
      <title>"ActiveRecord Calculations" by Bill Shobe</title>
      <description>I would love to try this.  How do I use the .diff file?

Thanks.</description>
      <pubDate>Wed, 13 Dec 2006 10:30:46 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:f83bf2fc-367e-4ed3-acfd-4f3868fc24b2</guid>
      <link>http://i.nfectio.us/articles/2006/11/05/activerecord-calculations#comment-234</link>
    </item>
    <item>
      <title>"ActiveRecord Calculations" by Bob Silva</title>
      <description>I use the Ruby bindings with ASE ChartDirector at &lt;a href="http://www.advsofteng.com/" rel="nofollow"&gt;http://www.advsofteng.com/&lt;/a&gt;</description>
      <pubDate>Sun, 05 Nov 2006 19:40:59 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:a9bc8a8a-450d-45a7-b810-31bd59c7f902</guid>
      <link>http://i.nfectio.us/articles/2006/11/05/activerecord-calculations#comment-222</link>
    </item>
    <item>
      <title>"ActiveRecord Calculations" by Mike Sax</title>
      <description>Hi Bob, very cooll... so what are you using for graphing? Gruff?  I'll have to do graphing pretty soon and it doesn't like there are many options out there. </description>
      <pubDate>Sun, 05 Nov 2006 16:46:45 -0800</pubDate>
      <guid isPermaLink="false">urn:uuid:2ec3c2f3-d5d2-4653-a722-5152412092cc</guid>
      <link>http://i.nfectio.us/articles/2006/11/05/activerecord-calculations#comment-221</link>
    </item>
  </channel>
</rss>
