aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@plataformatec.com.br>2012-02-05 00:46:07 -0800
committerJosé Valim <jose.valim@plataformatec.com.br>2012-02-05 00:46:07 -0800
commita9bebaedb9c067397965806bf4153c9165d1b7ef (patch)
tree626019e59c940af5eaba30e0e84acfcfd6ed23d7 /actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
parent20bc3d4aaa2ee13667b14cc20e2c31c32ef7489e (diff)
parentbcd3b870cea567ffc626144a0292fba7797a4c78 (diff)
downloadrails-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/stylesheet_tag_helpers.rb')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
index 41958c6559..2584b67548 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb
@@ -65,6 +65,13 @@ module ActionView
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with a stylesheet_path named route
+ # Computes the full URL to a stylesheet asset in the public stylesheets directory.
+ # This will use +stylesheet_path+ internally, so most of their behaviors will be the same.
+ def stylesheet_url(source)
+ URI.join(current_host, path_to_stylesheet(source)).to_s
+ end
+ alias_method :url_to_stylesheet, :stylesheet_url # aliased to avoid conflicts with a stylesheet_url named route
+
# Returns a stylesheet link tag for the sources specified as arguments. If
# you don't specify an extension, <tt>.css</tt> will be appended automatically.
# You can modify the link attributes by passing a hash as the last argument.