Skip to content

Commit

Permalink
each_with_object on the view_assigns hash
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Nov 6, 2013
1 parent 9a4adb4 commit 779cd6e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions actionpack/lib/abstract_controller/rendering.rb
Expand Up @@ -65,14 +65,12 @@ def rendered_format
# 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
Expand Down

0 comments on commit 779cd6e

Please sign in to comment.