named_scope and loaded associations with :dependent => :destroy

Hi,

is the following a known issue? Given the following setup:

class User < AR   has_many :posts, :dependent => :destroy end

class Post < AR   named_scope :title_like, lambda { |title| .... [some conditions] .... end

Then

u = User.first u.posts # Do something that loads posts u.posts.title_like('term').delete_all

deletes *all* posts from u - not just the ones with 'term' in the title. This is because :dependent => :destroy makes the association enumerate the loaded target ignoring the scope.

Cheers Tim

This is news to me, but sounds nasty and definitely a bug.

Can you reproduce it in a test case in AR itself?