From 42a1b0c7c31400c762e2f8d1aff16338bbe8d63d Mon Sep 17 00:00:00 2001 From: Anton Kolomiychuk Date: Tue, 23 Jun 2015 00:36:19 +0600 Subject: Add nil check in asset_path --- actionview/lib/action_view/helpers/asset_url_helper.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/helpers/asset_url_helper.rb b/actionview/lib/action_view/helpers/asset_url_helper.rb index ef4a6c98c0..f36e9a108f 100644 --- a/actionview/lib/action_view/helpers/asset_url_helper.rb +++ b/actionview/lib/action_view/helpers/asset_url_helper.rb @@ -121,6 +121,8 @@ module ActionView # asset_path "application", type: :stylesheet # => /assets/application.css # asset_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js def asset_path(source, options = {}) + raise ArgumentError, "Cannot pass nil as asset source" if source.nil? + source = source.to_s return "" unless source.present? return source if source =~ URI_REGEXP -- cgit v1.2.3