提交 38454983 编写于 作者: J Jeremy Kemper

Cache asset ids.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7607 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 e711d8fa
*SVN*
* Cache asset ids. [Jeremy Kemper]
* Optimized named routes respect AbstractRequest.relative_url_root. #9612 [danielmorrison, Jeremy Kemper]
* Introduce ActionController::Base.rescue_from to declare exception-handling methods. Cleaner style than the case-heavy rescue_action_in_public. #9449 [norbert]
......
......@@ -409,9 +409,18 @@ def compute_asset_host(source)
# Use the RAILS_ASSET_ID environment variable or the source's
# modification time as its cache-busting asset id.
def rails_asset_id(source)
ENV["RAILS_ASSET_ID"] ||
File.mtime(File.join(ASSETS_DIR, source)).to_i.to_s rescue ""
if asset_id = ENV["RAILS_ASSET_ID"]
asset_id
else
@@asset_id_cache[source] ||=
if File.exist?(path = File.join(ASSETS_DIR, source))
File.mtime(path).to_i.to_s
else
''
end
end
end
@@asset_id_cache = {}
# Break out the asset path rewrite so you wish to put the asset id
# someplace other than the query string.
......@@ -451,4 +460,4 @@ def join_asset_file_contents(paths)
end
end
end
end
\ No newline at end of file
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册