Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

don't fail if association conditions aren't specified for nested asso…

…ciation check
  • Loading branch information...
commit 1be5bf7a577e6353de966b2a29cd70743c845b97 1 parent c88cb8f
@ryanb ryanb authored
Showing with 2 additions and 1 deletion.
  1. +1 −1  lib/cancan/can_definition.rb
  2. +1 −0  spec/cancan/ability_spec.rb
View
2  lib/cancan/can_definition.rb
@@ -104,7 +104,7 @@ def matches_conditions_hash?(subject, conditions = @conditions)
def nested_subject_matches_conditions?(subject_hash)
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
def call_block_with_all(action, subject, extra_args)
View
1  spec/cancan/ability_spec.rb
@@ -254,6 +254,7 @@
@ability.can :read, Range, :string => {:length => 3}
@ability.can?(:read, "foo" => Range).should be_true
@ability.can?(:read, "foobar" => Range).should be_false
+ @ability.can?(:read, 123 => Range).should be_true
end
describe "unauthorized message" do
Please sign in to comment.
Something went wrong with that request. Please try again.