aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2014-11-25 15:03:23 -0700
committerSean Griffin <sean@seantheprogrammer.com>2014-11-25 15:03:23 -0700
commit708e1109d14ed3b2fd68e3cc35f83c8519b9269f (patch)
tree4ac771ed10243b64fedf9e7e8509ff519ee33958 /actionview
parentf84ffdd5dee019941b695891f31a07c5c28a3346 (diff)
parent8f7434adba492bfa52463d1eeeaf7d5cb16288f6 (diff)
downloadrails-708e1109d14ed3b2fd68e3cc35f83c8519b9269f.tar.gz
rails-708e1109d14ed3b2fd68e3cc35f83c8519b9269f.tar.bz2
rails-708e1109d14ed3b2fd68e3cc35f83c8519b9269f.zip
Merge pull request #17771 from agis-/issue-17373
Local vars should exist in partials for falsy `:object:` values too
Diffstat (limited to 'actionview')
-rw-r--r--actionview/CHANGELOG.md7
-rw-r--r--actionview/lib/action_view/renderer/partial_renderer.rb4
2 files changed, 9 insertions, 2 deletions
diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md
index 6b7adbe4a3..de65543137 100644
--- a/actionview/CHANGELOG.md
+++ b/actionview/CHANGELOG.md
@@ -1,3 +1,10 @@
+* Local variable in a partial is now available even if a falsy value is
+ passed to `:object` when rendering a partial.
+
+ Fixes #17373.
+
+ *Agis Anastasopoulos*
+
* Add support for `:enforce_utf8` option in `form_for`.
This is the same option that was added in 06388b0 to `form_tag` and allows
diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb
index 0407632435..338ae270d2 100644
--- a/actionview/lib/action_view/renderer/partial_renderer.rb
+++ b/actionview/lib/action_view/renderer/partial_renderer.rb
@@ -366,7 +366,7 @@ module ActionView
partial = options[:partial]
if String === partial
- @object = options[:object]
+ @object = options[:object] if options.has_key?(:object)
@collection = collection_from_options
@path = partial
else
@@ -506,7 +506,7 @@ module ActionView
def retrieve_template_keys
keys = @locals.keys
- keys << @variable if @object || @collection
+ keys << @variable if defined?(@object) || @collection
if @collection
keys << @variable_counter
keys << @variable_iteration