fixing issue when using accessible_by with nil can conditions - closes #66
This commit is contained in:
		
							parent
							
								
									605063b974
								
							
						
					
					
						commit
						7543eedd6a
					
				| @ -1,3 +1,7 @@ | |||||||
|  | * Fix issue when using accessible_by with nil can conditions (thanks jrallison) - see issue #66 | ||||||
|  | 
 | ||||||
|  | * Pluralize table name for belongs_to associations in can conditions hash (thanks logandk) - see issue #62 | ||||||
|  | 
 | ||||||
| * Support has_many association or arrays in can conditions hash | * Support has_many association or arrays in can conditions hash | ||||||
| 
 | 
 | ||||||
| * Adding joins clause to accessible_by when conditions are across associations | * Adding joins clause to accessible_by when conditions are across associations | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ module CanCan | |||||||
|       @base_behavior = base_behavior |       @base_behavior = base_behavior | ||||||
|       @actions = [action].flatten |       @actions = [action].flatten | ||||||
|       @subjects = [subject].flatten |       @subjects = [subject].flatten | ||||||
|       @conditions = conditions |       @conditions = conditions || {} | ||||||
|       @block = block |       @block = block | ||||||
|     end |     end | ||||||
|    |    | ||||||
|  | |||||||
| @ -36,4 +36,9 @@ describe CanCan::CanDefinition do | |||||||
|     @conditions[:test] = 1 |     @conditions[:test] = 1 | ||||||
|     @can.conditions(:tableize => true).should == { :foos => { :bar => 1}, :test => 1 } |     @can.conditions(:tableize => true).should == { :foos => { :bar => 1}, :test => 1 } | ||||||
|   end |   end | ||||||
|  |    | ||||||
|  |   it "should return no association joins if conditions is nil" do | ||||||
|  |     can = CanCan::CanDefinition.new(true, :read, Integer, nil, nil) | ||||||
|  |     can.association_joins.should be_nil | ||||||
|  |   end | ||||||
| end | end | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 John Allison
						John Allison