aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/renderer
diff options
context:
space:
mode:
authorSteven Harman <steven@harmanly.com>2016-07-26 10:37:10 -0400
committerSteven Harman <steven@harmanly.com>2016-07-26 10:38:58 -0400
commite4a4936244988f76318a0b219a3cc0bcdcdf3e30 (patch)
tree5982cc372e51c462e8ed337bd09ac55d34705d83 /actionview/lib/action_view/renderer
parent578096b9712a018b0241cb051dc0051239f62193 (diff)
downloadrails-e4a4936244988f76318a0b219a3cc0bcdcdf3e30.tar.gz
rails-e4a4936244988f76318a0b219a3cc0bcdcdf3e30.tar.bz2
rails-e4a4936244988f76318a0b219a3cc0bcdcdf3e30.zip
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.
Diffstat (limited to 'actionview/lib/action_view/renderer')
-rw-r--r--actionview/lib/action_view/renderer/partial_renderer.rb2
1 files changed, 1 insertions, 1 deletions
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