On 2/8/07, Ben J. [email protected] wrote:
to wait a bit before I can explore it. The calculate method requires a
column to be specified.
category_obj.products.calculate( :count, “*”, :include => :whatever,
:conditions => “blah” )
The problem is that when you pass the include parameter it breaks it.
Give it a try, kind of hard to explain but you get an sql error.
I really should read the docs a little better
The include option is not included in the calculate method. The sql
that I got was due to the included table not being included as a JOIN
Instead you need to use the old school and verbose :join option
So in your case
category_obj.products.calculate( :count, “*”, :join => “LEFT JOIN
ON whatever.product_id”, :conditions => blah )
Sorry But I can’t spend any more time on this at the moment. If it’s
a problem if someone else can step in or it’ll have to wait until I get