aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib
diff options
context:
space:
mode:
authorHenrik Nygren <nygrenh@gmail.com>2015-05-14 09:42:55 +0300
committerHenrik Nygren <nygrenh@gmail.com>2015-05-14 10:46:44 +0300
commitbef9484cf867ab261891d3431782e60c4e17f87f (patch)
tree20d2436600193a9fcd756b564aeb0153c8425ecb /actionview/lib
parent987a45307f8ca0b8b6cbab3763180cbe4eee18b7 (diff)
downloadrails-bef9484cf867ab261891d3431782e60c4e17f87f.tar.gz
rails-bef9484cf867ab261891d3431782e60c4e17f87f.tar.bz2
rails-bef9484cf867ab261891d3431782e60c4e17f87f.zip
Do not put partial name to local_assigns when rendering without an object
When one rendered a partial template without specifying an object or a collection (e.g. <%= render partial: 'partial_name' %>), Rails would make an object called :partial_name available in local_assigns. I don't think this was the intended behavior, since no local variable called 'partial_name' gets defined in the view.
Diffstat (limited to 'actionview/lib')
-rw-r--r--actionview/lib/action_view/renderer/partial_renderer.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb
index cd151c0189..b751bca31e 100644
--- a/actionview/lib/action_view/renderer/partial_renderer.rb
+++ b/actionview/lib/action_view/renderer/partial_renderer.rb
@@ -338,7 +338,7 @@ module ActionView
end
object ||= locals[as]
- locals[as] = object
+ locals[as] = object if @has_object
content = @template.render(view, locals) do |*name|
view._layout_for(*name, &block)