diff options
author | Joshua Peek <josh@joshpeek.com> | 2012-10-13 10:13:47 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2012-10-13 10:13:47 -0500 |
commit | 60a4fffd83e94ad4471570b16f9d954f04bc0300 (patch) | |
tree | 8652a0bc3d0fe388d9be1419c5fa1fedd2a228bb /actionpack/lib/action_view/helpers | |
parent | 5dfeb1b852c6c4a7b9c4aa3fa8dc5f25b516f9f1 (diff) | |
download | rails-60a4fffd83e94ad4471570b16f9d954f04bc0300.tar.gz rails-60a4fffd83e94ad4471570b16f9d954f04bc0300.tar.bz2 rails-60a4fffd83e94ad4471570b16f9d954f04bc0300.zip |
Allow asset url config to be undefined
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_url_helper.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_url_helper.rb b/actionpack/lib/action_view/helpers/asset_url_helper.rb index 9255c1e2f6..a0fcac59a3 100644 --- a/actionpack/lib/action_view/helpers/asset_url_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_url_helper.rb @@ -135,7 +135,9 @@ module ActionView source = compute_asset_path(source, options) end - if relative_url_root = config.relative_url_root || asset_request.try(:script_name) + relative_url_root = (defined?(config.relative_url_root) && config.relative_url_root) || + (asset_request && asset_request.script_name) + if relative_url_root source = "#{relative_url_root}#{source}" unless source.starts_with?("#{relative_url_root}/") end @@ -180,7 +182,7 @@ module ActionView # (proc or otherwise). def compute_asset_host(source = "", options = {}) request = asset_request - host = config.asset_host + host = config.asset_host if defined? config.asset_host host ||= request.base_url if request && options[:protocol] == :request return unless host |