fixing mongoid 'or' error - closes #322

This commit is contained in:
Ryan Bates 2011-03-29 17:49:18 -07:00
parent fb8e9bde57
commit e96cf5bea4

View File

@ -20,7 +20,9 @@ module CanCan
@model_class.where(:_id => {'$exists' => false, '$type' => 7}) # return no records in Mongoid @model_class.where(:_id => {'$exists' => false, '$type' => 7}) # return no records in Mongoid
else else
@rules.inject(@model_class.all) do |records, rule| @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) records.or(rule.conditions)
else else
records.excludes(rule.conditions) records.excludes(rule.conditions)