aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
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