make sure ActiveRecord::Relation is defined before checking conditions against it so Rails 2 is supported again - closes #312
This commit is contained in:
		
							parent
							
								
									1ac8099f7a
								
							
						
					
					
						commit
						89e40987d8
					
				@ -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
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user