diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2013-11-06 13:54:15 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2013-11-06 13:54:15 -0800 |
commit | 779cd6ec61d9ca362d05fd113bcc219ff38eaf6c (patch) | |
tree | 29c3cf3082fa4856beecfb023dca2b76f8acf109 | |
parent | 9a4adb4b05dafa9d61ec88acdd089b79585ce10e (diff) | |
download | rails-779cd6ec61d9ca362d05fd113bcc219ff38eaf6c.tar.gz rails-779cd6ec61d9ca362d05fd113bcc219ff38eaf6c.tar.bz2 rails-779cd6ec61d9ca362d05fd113bcc219ff38eaf6c.zip |
each_with_object on the view_assigns hash
-rw-r--r-- | actionpack/lib/abstract_controller/rendering.rb | 4 |
1 files changed, 1 insertions, 3 deletions
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 |