From 779cd6ec61d9ca362d05fd113bcc219ff38eaf6c Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 6 Nov 2013 13:54:15 -0800 Subject: each_with_object on the view_assigns hash --- actionpack/lib/abstract_controller/rendering.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'actionpack/lib/abstract_controller') diff --git a/actionpack/lib/abstract_controller/rendering.rb b/actionpack/lib/abstract_controller/rendering.rb index 1e30593af1..a60fe7c1c1 100644 --- a/actionpack/lib/abstract_controller/rendering.rb +++ b/actionpack/lib/abstract_controller/rendering.rb @@ -65,14 +65,12 @@ module AbstractController # You can overwrite this configuration per controller. # :api: public def view_assigns - hash = {} variables = instance_variables variables -= protected_instance_variables variables -= DEFAULT_PROTECTED_INSTANCE_VARIABLES - variables.each { |name| + variables.each_with_object({}) { |name, hash| hash[name.slice(1, name.length)] = instance_variable_get(name) } - hash end # Normalize args by converting render "foo" to render :action => "foo" and -- cgit v1.2.3