fixing issue when using accessible_by with nil can conditions - closes #66

This commit is contained in:
John Allison 2010-05-20 17:06:10 -07:00 committed by Ryan Bates
parent 605063b974
commit 7543eedd6a
3 changed files with 10 additions and 1 deletions

View File

@ -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
* Adding joins clause to accessible_by when conditions are across associations

View File

@ -8,7 +8,7 @@ module CanCan
@base_behavior = base_behavior
@actions = [action].flatten
@subjects = [subject].flatten
@conditions = conditions
@conditions = conditions || {}
@block = block
end

View File

@ -36,4 +36,9 @@ describe CanCan::CanDefinition do
@conditions[:test] = 1
@can.conditions(:tableize => true).should == { :foos => { :bar => 1}, :test => 1 }
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