include and scopes


I recently changed to rails 3 and the chainability for relations(i.e.

so here's my question: can i use scopes in my includes to avoid
1+n-query problem?

i have:

class A < ActiveRecord::Base
  has_many :bs

class B < ActiveRecord::Base
  scope :auto, where('auto') # auto is a boolean

now i would like to do this:
as = A.includes(:bs)
as.each do |a| #do something

but of course i get 1+n queries.
in rails 2 i would add this to my A class:
has_many :bs_auto, :class_name => 'B', :conditions => 'auto'

now when i call:
as = A.includes(:bs_auto)
as.each do |a|
  a.bs_auto #do something

i will get 2 queries.

can i do something like that with my rails 3-example and scopes? or do i
need the additional relation as well?

no one?

Are you saying you can no longer use the same code in Rails 3 or are
you asking whether there is a better way to achieve the same thing?


the latter.

i would like to avoid:
has_many :bs_auto, :class_name => 'B', :conditions => 'auto'


the many enquiries.