diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-02-05 00:46:07 -0800 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-02-05 00:46:07 -0800 |
commit | a9bebaedb9c067397965806bf4153c9165d1b7ef (patch) | |
tree | 626019e59c940af5eaba30e0e84acfcfd6ed23d7 /actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb | |
parent | 20bc3d4aaa2ee13667b14cc20e2c31c32ef7489e (diff) | |
parent | bcd3b870cea567ffc626144a0292fba7797a4c78 (diff) | |
download | rails-a9bebaedb9c067397965806bf4153c9165d1b7ef.tar.gz rails-a9bebaedb9c067397965806bf4153c9165d1b7ef.tar.bz2 rails-a9bebaedb9c067397965806bf4153c9165d1b7ef.zip |
Merge pull request #4875 from sikachu/master-asset-url
Add *_url helpers to get the full assets URL
Diffstat (limited to 'actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb index d9f1f88ade..c67f81dcf4 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/javascript_tag_helpers.rb @@ -87,6 +87,13 @@ module ActionView end alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with a javascript_path named route + # Computes the full URL to a javascript asset in the public javascripts directory. + # This will use +javascript_path+ internally, so most of their behaviors will be the same. + def javascript_url(source) + URI.join(current_host, path_to_javascript(source)).to_s + end + alias_method :url_to_javascript, :javascript_url # aliased to avoid conflicts with a javascript_url named route + # Returns an HTML script tag for each of the +sources+ provided. # # Sources may be paths to JavaScript files. Relative paths are assumed to be relative |