提交 53d3bafc 编写于 作者: E Evan Petrie

ruby 1.9.2 and other ruby implementations may not return the same hash value...

ruby 1.9.2 and other ruby implementations may not return the same hash value for the same string each time. This can result in your static assets being served from different asset hosts, which makes browser caching less effective. Use md5 or some other digest method instead.
上级 6b6ecbef
...@@ -57,7 +57,7 @@ module Helpers #:nodoc: ...@@ -57,7 +57,7 @@ module Helpers #:nodoc:
# +asset_host+ to a proc like this: # +asset_host+ to a proc like this:
# #
# ActionController::Base.asset_host = Proc.new { |source| # ActionController::Base.asset_host = Proc.new { |source|
# "http://assets#{source.hash % 2 + 1}.example.com" # "http://assets#{Digest::MD5.hexdigest(source).to_i(16) % 2 + 1}.example.com"
# } # }
# image_tag("rails.png") # image_tag("rails.png")
# # => <img alt="Rails" src="http://assets1.example.com/images/rails.png?1230601161" /> # # => <img alt="Rails" src="http://assets1.example.com/images/rails.png?1230601161" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册