Skip to content

Commit

Permalink
ruby 1.9.2 and other ruby implementations may not return the same has…
Browse files Browse the repository at this point in the history
…h 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.
  • Loading branch information
Evan Petrie committed Apr 14, 2011
1 parent 6b6ecbe commit 53d3baf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion actionpack/lib/action_view/helpers/asset_tag_helper.rb
Expand Up @@ -57,7 +57,7 @@ module Helpers #:nodoc:
# +asset_host+ to a proc like this:
#
# 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")
# # => <img alt="Rails" src="http://assets1.example.com/images/rails.png?1230601161" />
Expand Down

0 comments on commit 53d3baf

Please sign in to comment.