make sure ActiveRecord::Relation is defined before checking conditions against it so Rails 2 is supported again - closes #312

This commit is contained in:
Ryan Bates 2011-03-25 14:26:33 -07:00
parent 1ac8099f7a
commit 89e40987d8

View File

@ -99,7 +99,7 @@ module CanCan
def override_scope def override_scope
conditions = @rules.map(&:conditions).compact conditions = @rules.map(&:conditions).compact
if conditions.any? { |c| c.kind_of?(ActiveRecord::Relation) } if defined?(ActiveRecord::Relation) && conditions.any? { |c| c.kind_of?(ActiveRecord::Relation) }
if conditions.size == 1 if conditions.size == 1
conditions.first conditions.first
else else