Merge pull request #17771 from agis-/issue-17373

Local vars should exist in partials for falsy `:object:` values too
This commit is contained in:
Sean Griffin 2014-11-25 15:03:23 -07:00
commit 708e1109d1
2 changed files with 9 additions and 2 deletions

@ -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

@ -366,7 +366,7 @@ def setup(context, options, block)
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 @@ def merge_prefix_into_object_path(prefix, object_path)
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