From 3f5f330763dc3b689222ede393c62446350f0ae6 Mon Sep 17 00:00:00 2001 From: Victor Martinez Date: Thu, 21 Nov 2013 14:20:35 +0100 Subject: [PATCH] FIX: Variable collision prevents defining permissions with multiple nested conditions --- lib/cancan/model_adapters/active_record_adapter.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/cancan/model_adapters/active_record_adapter.rb b/lib/cancan/model_adapters/active_record_adapter.rb index 6856bb7b..639b8d80 100644 --- a/lib/cancan/model_adapters/active_record_adapter.rb +++ b/lib/cancan/model_adapters/active_record_adapter.rb @@ -73,8 +73,7 @@ def tableized_conditions(conditions, model_class = @model_class) value.delete(k) nested[k] = v else - name = model_class.reflect_on_association(name).table_name.to_sym - result_hash[name] = value + result_hash[model_class.reflect_on_association(name).table_name.to_sym] = value end nested end