From dfab28b2ca28b477f83befbba639adb6d15c8ce0 Mon Sep 17 00:00:00 2001 From: Tieg Zaharia Date: Mon, 16 Apr 2012 13:53:51 -0400 Subject: catch nil.to_sym errors in partial_renderer, and raise ArgumentError instead --- actionpack/lib/action_view/renderer/partial_renderer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/renderer') diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index 8b53867aea..4d57a8f033 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -451,7 +451,7 @@ module ActionView end def retrieve_variable(path) - variable = @options[:as].try(:to_sym) || path[%r'_?(\w+)(\.\w+)*$', 1].to_sym + variable = @options[:as].try(:to_sym) || path[%r'_?(\w+)(\.\w+)*$', 1].try(:to_sym) variable_counter = :"#{variable}_counter" if @collection [variable, variable_counter] end -- cgit v1.2.3 From 5d8d639f0086aff5cb63587b629968f8439d65d7 Mon Sep 17 00:00:00 2001 From: Tieg Zaharia Date: Mon, 16 Apr 2012 15:33:15 -0400 Subject: converting some tests to assert_raises, and DRY'ing retrieve_variable changes --- actionpack/lib/action_view/renderer/partial_renderer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionpack/lib/action_view/renderer') diff --git a/actionpack/lib/action_view/renderer/partial_renderer.rb b/actionpack/lib/action_view/renderer/partial_renderer.rb index 4d57a8f033..34ea06c9cf 100644 --- a/actionpack/lib/action_view/renderer/partial_renderer.rb +++ b/actionpack/lib/action_view/renderer/partial_renderer.rb @@ -451,7 +451,7 @@ module ActionView end def retrieve_variable(path) - variable = @options[:as].try(:to_sym) || path[%r'_?(\w+)(\.\w+)*$', 1].try(:to_sym) + variable = @options.fetch(:as) { path[%r'_?(\w+)(\.\w+)*$', 1] }.try(:to_sym) variable_counter = :"#{variable}_counter" if @collection [variable, variable_counter] end -- cgit v1.2.3