ryanb/cancan — pull request #971 by matt-glover (2013-12-08 00:44:43+00:00)
Title: Do Not Execute Scope When Checking Class Rule

I expect that a class level access `can?` check will not trigger a scope defined on the ability. The current code executes a count against the scope and drives logic based on the result. This pull patches the presumably inadvertent scope execution. If that scope execution is the expected behavior then this pull should be rejected and the docs should be clarified to make this behavior explicit.

For example, I expect the following will **not** trigger `Foo.some_scoped_query`:
```ruby
# Ability.rb
can :read, Foo, Foo.some_scoped_query do |foo|
foo.some_instance_check
end

# In some controller
can?(:read, Foo)
```

In the current code CanCan checks the conditions on a rule to see if they are empty. `@conditions.empty?` calls `ActiveRecord::Relation#empty?` when a scoped condition is provided. `ActiveRecord::Relation#empty?` will execute the scoped query as a count to see if any records are returned.