From f236b1b5a40a7a89adc5eca667f1baeaa3fb56a5 Mon Sep 17 00:00:00 2001 From: Sokolov Yura Date: Mon, 13 Sep 2010 20:15:38 +0800 Subject: [PATCH] resolve issue 149 --- lib/cancan/can_definition.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/cancan/can_definition.rb b/lib/cancan/can_definition.rb index 14c6c8a..06fc302 100644 --- a/lib/cancan/can_definition.rb +++ b/lib/cancan/can_definition.rb @@ -41,6 +41,7 @@ module CanCan end def tableized_conditions(conditions = @conditions) + return conditions unless conditions.kind_of? Hash conditions.inject({}) do |result_hash, (name, value)| if value.kind_of? Hash name = name.to_s.tableize.to_sym @@ -63,7 +64,7 @@ module CanCan hash = {} conditions.map do |name, value| hash[name] = associations_hash(value) if value.kind_of? Hash - end + end if conditions.kind_of? Hash hash end @@ -71,7 +72,7 @@ module CanCan attributes = {} @conditions.each do |key, value| attributes[key] = value unless [Array, Range, Hash].include? value.class - end + end if conditions.kind_of? Hash attributes end