From 1c30ec23fef2479cd037945e57a74e5c89c9ece1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 15 Jan 2010 17:43:45 +0100 Subject: In heterogeneous collections, neither the @path nor the @template are available, so we need to tell that we are simply rendering a collection. --- actionpack/lib/action_view/render/partials.rb | 2 +- actionpack/test/template/subscriber_test.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/actionpack/lib/action_view/render/partials.rb b/actionpack/lib/action_view/render/partials.rb index 2a32e2428a..8c936ae09e 100644 --- a/actionpack/lib/action_view/render/partials.rb +++ b/actionpack/lib/action_view/render/partials.rb @@ -216,7 +216,7 @@ module ActionView if @collection ActiveSupport::Notifications.instrument("action_view.render_collection", - :identifier => identifier, :count => @collection.size) do + :identifier => identifier || "collection", :count => @collection.size) do render_collection end else diff --git a/actionpack/test/template/subscriber_test.rb b/actionpack/test/template/subscriber_test.rb index 2f58638364..d64637f141 100644 --- a/actionpack/test/template/subscriber_test.rb +++ b/actionpack/test/template/subscriber_test.rb @@ -63,6 +63,16 @@ module ActionViewSubscriberTest assert_match /Rendered test\/_customer.erb/, @logger.logged(:info).last end + def test_render_collection_template_without_path + @view.stubs(:controller_path).returns("test") + @view.render([ GoodCustomer.new("david"), Customer.new("mary") ], :greeting => "hi") + wait + + assert_equal 1, @logger.logged(:info).size + assert_match /Rendered collection/, @logger.logged(:info).last + end + + class SyncSubscriberTest < ActiveSupport::TestCase include Rails::Subscriber::SyncTestHelper include ActionViewSubscriberTest -- cgit v1.2.3