mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Local vars should exist in partials for falsy :object:
values too
c67005f221
made the local var in partials
available only if what passed to `:object` was truthy.
For example this would not make the local variable `foo` available inside the
partial:
render partial: 'foo', object: false
Fixes #17373.
This commit is contained in:
parent
4426b726bf
commit
8f7434adba
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 @@ 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
|
||||
|
|
Loading…
Reference in a new issue