diff options
author | José Valim <jose.valim@gmail.com> | 2010-10-10 09:24:17 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-10-10 09:26:53 +0200 |
commit | 38d78f99d52801d8392a7229b40edae74cc3d142 (patch) | |
tree | 1526a3dd884ec1cadb287b8c8a54dbe160201d19 /actionpack/lib/action_view/testing | |
parent | c7408a0e40545558872efb4129fe4bf097c9ce2f (diff) | |
download | rails-38d78f99d52801d8392a7229b40edae74cc3d142.tar.gz rails-38d78f99d52801d8392a7229b40edae74cc3d142.tar.bz2 rails-38d78f99d52801d8392a7229b40edae74cc3d142.zip |
Resolvers now consider timestamps.
Before this patch, every request in development caused the template
to be compiled, regardless if it was updated in the filesystem or not.
This patch now checks the timestamp and only compiles it again if
any change was done.
While this probably won't show any difference for current setups,
but it will be useful for asset template handlers (like SASS), as
compiling their templates is slower than ERb, Haml, etc.
Diffstat (limited to 'actionpack/lib/action_view/testing')
-rw-r--r-- | actionpack/lib/action_view/testing/resolvers.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/testing/resolvers.rb b/actionpack/lib/action_view/testing/resolvers.rb index ec0db48379..55583096e0 100644 --- a/actionpack/lib/action_view/testing/resolvers.rb +++ b/actionpack/lib/action_view/testing/resolvers.rb @@ -23,11 +23,12 @@ module ActionView #:nodoc: query = /^(#{Regexp.escape(path)})#{query}$/ templates = [] - @hash.each do |_path, source| + @hash.each do |_path, array| + source, updated_at = array next unless _path =~ query handler, format = extract_handler_and_format(_path, formats) templates << Template.new(source, _path, handler, - :virtual_path => $1, :format => format) + :virtual_path => $1, :format => format, :updated_at => updated_at) end templates.sort_by {|t| -t.identifier.match(/^#{query}$/).captures.reject(&:blank?).size } |