1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #22279 from yui-knk/fix_object_partial_false

Respect value of `:object` if `:object` is false when rendering
This commit is contained in:
Richard Schneeman 2015-11-12 21:47:43 -06:00
commit c7368fd86d
4 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,9 @@
* Respect value of `:object` if `:object` is false when rendering.
Fixes #22260.
*Yuichiro Kaneko*
* Generate `week_field` input values using a 1-based index and not a 0-based index
as per the W3 spec: http://www.w3.org/TR/html-markup/datatypes.html#form.data.week

View file

@ -337,7 +337,7 @@ module ActionView
layout = find_template(layout.to_s, @template_keys)
end
object ||= locals[as]
object = locals[as] if object.nil? # Respect object when object is false
locals[as] = object if @has_object
content = @template.render(view, locals) do |*name|

View file

@ -0,0 +1 @@
<%= klass.class.name %>

View file

@ -247,6 +247,8 @@ module RenderTestCases
def test_render_object
assert_equal "Hello: david", @view.render(:partial => "test/customer", :object => Customer.new("david"))
assert_equal "FalseClass", @view.render(:partial => "test/klass", :object => false)
assert_equal "NilClass", @view.render(:partial => "test/klass", :object => nil)
end
def test_render_object_with_array