From d28ed9f5360b54320b2d1baaa2e6d0e3f3f941fc Mon Sep 17 00:00:00 2001 From: Juanito Fatas Date: Sun, 25 May 2014 16:18:51 +0800 Subject: [PATCH] Convert source to string if it is present. --- actionview/lib/action_view/helpers/asset_url_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actionview/lib/action_view/helpers/asset_url_helper.rb b/actionview/lib/action_view/helpers/asset_url_helper.rb index ae684af87b..2b009ba961 100644 --- a/actionview/lib/action_view/helpers/asset_url_helper.rb +++ b/actionview/lib/action_view/helpers/asset_url_helper.rb @@ -118,8 +118,8 @@ module ActionView # asset_path "application", type: :stylesheet # => /stylesheets/application.css # asset_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js def asset_path(source, options = {}) - source = source.to_s return "" unless source.present? + source = source.to_s return source if source =~ URI_REGEXP tail, source = source[/([\?#].+)$/], source.sub(/([\?#].+)$/, '')