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

Can you reproduce it in a test case in AR itself?
On Monday, July 27, 2009, tim <fischbach....@googlemail.com> wrote:
>
> 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
> >
>

-- 
Cheers

Koz

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To post to this group, send email to rubyonrails-core@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-core+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to