Permalink
Browse files

Fix to return scope instead of array

  • Loading branch information...
1 parent 4df69ad commit ea1b60d97872138a303227141b9d49174f673200 @maxprokopiev committed May 31, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/cancan/model_adapters/mongo_mapper_adapter.rb
@@ -32,7 +32,7 @@ def database_records
# there are no rules with empty conditions
rules = @rules.reject { |rule| rule.conditions.empty? }
process_can_rules = @rules.count == rules.count
- rules.inject(@model_class.all) do |records, rule|
+ rules.inject(@model_class.where) do |records, rule|
if process_can_rules && rule.base_behavior
records.or rule.conditions
elsif !rule.base_behavior

0 comments on commit ea1b60d

Please sign in to comment.