Skip to content
Browse files

ruby 1.9.2 and other ruby implementations may not return the same has…

…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...
1 parent 6b6ecbe commit 53d3bafc8bf3f0cb90a02751aa93b0c30b26ab78 Evan Petrie committed Apr 14, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 actionpack/lib/action_view/helpers/asset_tag_helper.rb
View
2 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -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" />

0 comments on commit 53d3baf

Please sign in to comment.
Something went wrong with that request. Please try again.