From e4a4936244988f76318a0b219a3cc0bcdcdf3e30 Mon Sep 17 00:00:00 2001 From: Steven Harman Date: Tue, 26 Jul 2016 10:37:10 -0400 Subject: Default to an empty collection if falsey given This will ensure we attempt to render an empty collection, meaning we don't actually render anything at all. Allowing `nil` or a falsey value through results in calling `render_partial` rather than `render_collection`, which isn't what we want. --- actionview/lib/action_view/renderer/partial_renderer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib/action_view/renderer') diff --git a/actionview/lib/action_view/renderer/partial_renderer.rb b/actionview/lib/action_view/renderer/partial_renderer.rb index 1b28c180e3..c2b6e6a290 100644 --- a/actionview/lib/action_view/renderer/partial_renderer.rb +++ b/actionview/lib/action_view/renderer/partial_renderer.rb @@ -403,7 +403,7 @@ module ActionView def collection_from_options if @options.key?(:collection) - collection = @options[:collection] + collection = @options[:collection] || [] collection = collection.to_ary if collection.respond_to?(:to_ary) collection end -- cgit v1.2.3