diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 338ae270d2..f627d5d40c 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -366,10 +366,12 @@ module ActionView partial = options[:partial] if String === partial - @object = options[:object] if options.has_key?(:object) + @has_object = options.key?(:object) + @object = options[:object] @collection = collection_from_options @path = partial else + @has_object = true @object = partial @collection = collection_from_object || collection_from_options @@ -506,7 +508,7 @@ module ActionView def retrieve_template_keys keys = @locals.keys - keys << @variable if defined?(@object) || @collection + keys << @variable if @has_object || @collection if @collection keys << @variable_counter keys << @variable_iteration