collectiveidea/awesome_nested_set — Issue #119: Broken scope during delete
Author: vickodin
Created: 2012-03-02 08:42:29+00:00
State: open

I think, that that scope conditions not works when I want to delete node.

Part of my app:
```ruby
class Site < ActiveRecord::Base
has_many :pages
end

class Page < ActiveRecord::Base
belongs_to :site
acts_as_nested_set :scope => :site
end
```
Problem:
When I make the destroy one of the pages, I see the next in the logs:

> SELECT id FROM "pages" WHERE ("lft" >= 2)

There is no "site_id" scope here.

But we have thousands pages with lft >=2; I need additional condition like "site_id = ?"

I thought, that, maybe, was DB-dependence, but and pq and mysql use the same query.