diff options
author | Prem Sichanugrist <s@sikachu.com> | 2012-02-03 18:10:37 -0500 |
---|---|---|
committer | Prem Sichanugrist <s@sikachu.com> | 2012-02-04 17:57:05 -0500 |
commit | bcd3b870cea567ffc626144a0292fba7797a4c78 (patch) | |
tree | 626019e59c940af5eaba30e0e84acfcfd6ed23d7 /railties/guides | |
parent | 20bc3d4aaa2ee13667b14cc20e2c31c32ef7489e (diff) | |
download | rails-bcd3b870cea567ffc626144a0292fba7797a4c78.tar.gz rails-bcd3b870cea567ffc626144a0292fba7797a4c78.tar.bz2 rails-bcd3b870cea567ffc626144a0292fba7797a4c78.zip |
Add *_url helpers to get the full assets URL
Adds `image_url`, `javascript_url`, `stylesheet_url`, `audio_url`,
`video_url`, and `font_url` to assets tag helper. These URL helpers will
return the full path to your assets. This is useful when you are going
to reference this asset from external host.
Diffstat (limited to 'railties/guides')
-rw-r--r-- | railties/guides/source/action_view_overview.textile | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index ac5c9fa4d8..3b0fbfb464 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -585,6 +585,14 @@ Computes the path to an image asset in the +public/images+ directory. Full paths image_path("edit.png") # => /images/edit.png </ruby> +h5. image_url + +Computes the url to an image asset in the +public/images+ directory. This will call +image_path+ internally and merge with your current host or your asset host. + +<ruby> +image_url("edit.png") # => http://www.example.com/images/edit.png +</ruby> + h5. image_tag Returns an html image tag for the source. The source can be a full path or a file that exists in your +public/images+ directory. @@ -629,6 +637,14 @@ Computes the path to a JavaScript asset in the +public/javascripts+ directory. I javascript_path "common" # => /javascripts/common.js </ruby> +h5. javascript_url + +Computes the url to a JavaScript asset in the +public/javascripts+ directory. This will call +javascript_path+ internally and merge with your current host or your asset host. + +<ruby> +javascript_url "common" # => http://www.example.com/javascripts/common.js +</ruby> + h5. stylesheet_link_tag Returns a stylesheet link tag for the sources specified as arguments. If you don't specify an extension, +.css+ will be appended automatically. @@ -659,6 +675,14 @@ Computes the path to a stylesheet asset in the +public/stylesheets+ directory. I stylesheet_path "application" # => /stylesheets/application.css </ruby> +h5. stylesheet_url + +Computes the url to a stylesheet asset in the +public/stylesheets+ directory. This will call +stylesheet_path+ internally and merge with your current host or your asset host. + +<ruby> +stylesheet_url "application" # => http://www.example.com/stylesheets/application.css +</ruby> + h4. AtomFeedHelper h5. atom_feed |