Skip to content
Browse files

fixing mongoid 'or' error - closes #322

  • Loading branch information...
1 parent fb8e9bd commit e96cf5bea470bf6fa6e21dd573b5210620984ab1 @ryanb committed Mar 29, 2011
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/cancan/model_adapters/mongoid_adapter.rb
View
4 lib/cancan/model_adapters/mongoid_adapter.rb
@@ -20,7 +20,9 @@ def database_records
@model_class.where(:_id => {'$exists' => false, '$type' => 7}) # return no records in Mongoid
else
@rules.inject(@model_class.all) do |records, rule|
- if rule.base_behavior
+ if rule.conditions.empty?
+ records
+ elsif rule.base_behavior
records.or(rule.conditions)
else
records.excludes(rule.conditions)

0 comments on commit e96cf5b

Please sign in to comment.
Something went wrong with that request. Please try again.