Rails 3.1 RC4 default_scope and count

I've run into an issue in Rails 3.1 RC4 where the count query is
failing because of a default_scope. The scope has an include and a
condition on the included association but count is dropping the
include. Here's what it looks like -

default_scope where('campaigns.inactive = ?',
false).order('funds.name').includes(:campaigns)

Rails 3.1 RC4 -

ruby-1.9.2-p180 :001 > Fund.count
[2011-06-12 14:35:43 | WARN | n/a | named_scope.rb:175:in
`valid_scope_name?']

Creating scope :all. Overwriting existing method Fund.all.

[2011-06-12 14:35:43 | DEBUG | n/a | log_subscriber.rb:105:in `debug']

   (0.4ms) SELECT COUNT(*) FROM "funds" WHERE (campaigns.inactive = 'f')

ActiveRecord::StatementInvalid: PGError: ERROR: missing FROM-clause
entry for table "campaigns"
LINE 1: SELECT COUNT(*) FROM "funds" WHERE (campaigns.inactive =
'f...

Rails 3.0.8 -

ruby-1.9.2-p180 :001 > Fund.count
=> 1

SQL (43.8ms) SELECT COUNT(DISTINCT "funds"."id") FROM "funds" LEFT
OUTER JOIN "campaigns" ON "campaigns"."fund_id" = "funds"."id" WHERE
(campaigns.inactive = 'f')

Please could you file this as an issue on Github, with a full example of
the models you are using?

Jon

Hi, I've always had problems when I used a "includes" in a default
scope with methods such as "count" or "built", try to remove the
"includes(:campaigns)", of course the ('campaigns.inactive = ?',
false) do not work.

You can use a specific scope like :actives, where('campaigns.inactive
= ?', false)

¿A better solution?