aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorVijay Dev <vijaydev.cse@gmail.com>2012-05-09 01:41:22 +0530
committerVijay Dev <vijaydev.cse@gmail.com>2012-05-09 01:41:22 +0530
commit8a9e031bcea772a5a9608fa17db824651138f352 (patch)
treee533b1a179f1527d26b83ae5dcbdf259d548c9d3 /actionpack/lib
parent2882a3c827a06b021dc950cd09568e0bac729c76 (diff)
downloadrails-8a9e031bcea772a5a9608fa17db824651138f352.tar.gz
rails-8a9e031bcea772a5a9608fa17db824651138f352.tar.bz2
rails-8a9e031bcea772a5a9608fa17db824651138f352.zip
update some examples in asset tag helper docs [ci skip]
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 7985683a72..adc62ec6a9 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -13,15 +13,16 @@ module ActionView
# the assets exist before linking to them:
#
# image_tag("rails.png")
- # # => <img alt="Rails" src="/images/rails.png?1230601161" />
+ # # => <img alt="Rails" src="/assets/rails.png" />
# stylesheet_link_tag("application")
- # # => <link href="/stylesheets/application.css?1232285206" media="screen" rel="stylesheet" />
+ # # => <link href="/assets/application.css?body=1" media="screen" rel="stylesheet" />
+ #
#
# === Using asset hosts
#
# By default, Rails links to these assets on the current host in the public
# folder, but you can direct Rails to link to assets from a dedicated asset
- # server by setting ActionController::Base.asset_host in the application
+ # server by setting <tt>ActionController::Base.asset_host</tt> in the application
# configuration, typically in <tt>config/environments/production.rb</tt>.
# For example, you'd define <tt>assets.example.com</tt> to be your asset
# host this way, inside the <tt>configure</tt> block of your environment-specific
@@ -32,9 +33,9 @@ module ActionView
# Helpers take that into account:
#
# image_tag("rails.png")
- # # => <img alt="Rails" src="http://assets.example.com/images/rails.png?1230601161" />
+ # # => <img alt="Rails" src="http://assets.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
- # # => <link href="http://assets.example.com/stylesheets/application.css?1232285206" media="screen" rel="stylesheet" />
+ # # => <link href="http://assets.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# Browsers typically open at most two simultaneous connections to a single
# host, which means your assets often have to wait for other assets to finish
@@ -45,9 +46,9 @@ module ActionView
# will open eight simultaneous connections rather than two.
#
# image_tag("rails.png")
- # # => <img alt="Rails" src="http://assets0.example.com/images/rails.png?1230601161" />
+ # # => <img alt="Rails" src="http://assets0.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
- # # => <link href="http://assets2.example.com/stylesheets/application.css?1232285206" media="screen" rel="stylesheet" />
+ # # => <link href="http://assets2.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# To do this, you can either setup four actual hosts, or you can use wildcard
# DNS to CNAME the wildcard to a single asset host. You can read more about
@@ -64,29 +65,28 @@ module ActionView
# "http://assets#{Digest::MD5.hexdigest(source).to_i(16) % 2 + 1}.example.com"
# }
# image_tag("rails.png")
- # # => <img alt="Rails" src="http://assets1.example.com/images/rails.png?1230601161" />
+ # # => <img alt="Rails" src="http://assets1.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
- # # => <link href="http://assets2.example.com/stylesheets/application.css?1232285206" media="screen" rel="stylesheet" />
+ # # => <link href="http://assets2.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# The example above generates "http://assets1.example.com" and
# "http://assets2.example.com". This option is useful for example if
# you need fewer/more than four hosts, custom host names, etc.
#
# As you see the proc takes a +source+ parameter. That's a string with the
- # absolute path of the asset with any extensions and timestamps in place,
- # for example "/images/rails.png?1230601161".
+ # absolute path of the asset, for example "/assets/rails.png".
#
# ActionController::Base.asset_host = Proc.new { |source|
- # if source.starts_with?('/images')
- # "http://images.example.com"
+ # if source.ends_with?('.css')
+ # "http://stylesheets.example.com"
# else
# "http://assets.example.com"
# end
# }
# image_tag("rails.png")
- # # => <img alt="Rails" src="http://images.example.com/images/rails.png?1230601161" />
+ # # => <img alt="Rails" src="http://assets.example.com/assets/rails.png" />
# stylesheet_link_tag("application")
- # # => <link href="http://assets.example.com/stylesheets/application.css?1232285206" media="screen" rel="stylesheet" />
+ # # => <link href="http://stylesheets.example.com/assets/application.css" media="screen" rel="stylesheet" />
#
# Alternatively you may ask for a second parameter +request+. That one is
# particularly useful for serving assets from an SSL-protected page. The