Merge pull request #17771 from agis-/issue-17373
Local vars should exist in partials for falsy `:object:` values too
This commit is contained in:
commit
708e1109d1
@ -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`.
|
* Add support for `:enforce_utf8` option in `form_for`.
|
||||||
|
|
||||||
This is the same option that was added in 06388b0 to `form_tag` and allows
|
This is the same option that was added in 06388b0 to `form_tag` and allows
|
||||||
|
@ -366,7 +366,7 @@ def setup(context, options, block)
|
|||||||
partial = options[:partial]
|
partial = options[:partial]
|
||||||
|
|
||||||
if String === partial
|
if String === partial
|
||||||
@object = options[:object]
|
@object = options[:object] if options.has_key?(:object)
|
||||||
@collection = collection_from_options
|
@collection = collection_from_options
|
||||||
@path = partial
|
@path = partial
|
||||||
else
|
else
|
||||||
@ -506,7 +506,7 @@ def merge_prefix_into_object_path(prefix, object_path)
|
|||||||
|
|
||||||
def retrieve_template_keys
|
def retrieve_template_keys
|
||||||
keys = @locals.keys
|
keys = @locals.keys
|
||||||
keys << @variable if @object || @collection
|
keys << @variable if defined?(@object) || @collection
|
||||||
if @collection
|
if @collection
|
||||||
keys << @variable_counter
|
keys << @variable_counter
|
||||||
keys << @variable_iteration
|
keys << @variable_iteration
|
||||||
|
Loading…
Reference in New Issue
Block a user