Eager loading association with condition

Hi,

To explain my problem, I'll use the standard Post/author example. Suppose I have

  class Post < ActiveRecord::Base     belongs_to :author   end

I am using following to fetch the posts and author info in a single query -

for post in Post.find(:all, :include => :author) ...

Now, I want to get *only* the posts whose author's name starts with "A". How do I do that?

(i.e. sort of Post.find(:all, :include => :author, :condition => ["post.author.name like 'A%'])

Thanks.

Bear in mind that your conditions are just a chunk of sql, so post.author.name is meaningless. authors.name does mean something to the db and should get you there.

Fred