aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-02-10 15:44:14 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2016-02-10 15:44:27 -0800
commitdfa0ab50f9d7357a670edb5178646176809f9e27 (patch)
tree8aff0cd0283be2f29f082035ded2ccc7f1ecad64
parent81f75f578a06bafd7cb23643760788a8ddc8d657 (diff)
downloadrails-dfa0ab50f9d7357a670edb5178646176809f9e27.tar.gz
rails-dfa0ab50f9d7357a670edb5178646176809f9e27.tar.bz2
rails-dfa0ab50f9d7357a670edb5178646176809f9e27.zip
sort templates after looking them up in the from the paths cache
The view paths cache will eventually query the filesystem when looking up templates: https://github.com/rails/rails/blob/2db347bebc9d3f39b3c5e274b7c9beecfce73913/actionview/lib/action_view/template/resolver.rb#L224-L230 The order in which files are returned is file system dependent. Since the template digest [depends on its children](https://github.com/rails/rails/blob/2db347bebc9d3f39b3c5e274b7c9beecfce73913/actionview/lib/action_view/digestor.rb#L109-L115), the order of the dependencies will impact the fingerprint. This commit sorts the wildcard dependencies so that we get a consistent hash. Fixes #23592
-rw-r--r--actionview/lib/action_view/dependency_tracker.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/actionview/lib/action_view/dependency_tracker.rb b/actionview/lib/action_view/dependency_tracker.rb
index fe98b370b7..7731773040 100644
--- a/actionview/lib/action_view/dependency_tracker.rb
+++ b/actionview/lib/action_view/dependency_tracker.rb
@@ -153,11 +153,11 @@ module ActionView
def resolve_directories(wildcard_dependencies)
return [] unless @view_paths
- wildcard_dependencies.each_with_object([]) do |query, templates|
- @view_paths.find_all_with_query(query).each do |template|
- templates << "#{File.dirname(query)}/#{File.basename(template).split('.').first}"
+ wildcard_dependencies.flat_map { |query, templates|
+ @view_paths.find_all_with_query(query).map do |template|
+ "#{File.dirname(query)}/#{File.basename(template).split('.').first}"
end
- end
+ }.sort
end
def explicit_dependencies