don't fail if association conditions aren't specified for nested association check
This commit is contained in:
		
							parent
							
								
									c88cb8f459
								
							
						
					
					
						commit
						1be5bf7a57
					
				@ -104,7 +104,7 @@ module CanCan
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def nested_subject_matches_conditions?(subject_hash)
 | 
					    def nested_subject_matches_conditions?(subject_hash)
 | 
				
			||||||
      parent, child = subject_hash.shift
 | 
					      parent, child = subject_hash.shift
 | 
				
			||||||
      matches_conditions_hash?(parent, @conditions[parent.class.name.downcase.to_sym])
 | 
					      matches_conditions_hash?(parent, @conditions[parent.class.name.downcase.to_sym] || {})
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def call_block_with_all(action, subject, extra_args)
 | 
					    def call_block_with_all(action, subject, extra_args)
 | 
				
			||||||
 | 
				
			|||||||
@ -254,6 +254,7 @@ describe CanCan::Ability do
 | 
				
			|||||||
    @ability.can :read, Range, :string => {:length => 3}
 | 
					    @ability.can :read, Range, :string => {:length => 3}
 | 
				
			||||||
    @ability.can?(:read, "foo" => Range).should be_true
 | 
					    @ability.can?(:read, "foo" => Range).should be_true
 | 
				
			||||||
    @ability.can?(:read, "foobar" => Range).should be_false
 | 
					    @ability.can?(:read, "foobar" => Range).should be_false
 | 
				
			||||||
 | 
					    @ability.can?(:read, 123 => Range).should be_true
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe "unauthorized message" do
 | 
					  describe "unauthorized message" do
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user