aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-29 06:02:16 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-10-29 11:14:14 -0200
commit3663057518eb9acf9b1e72f47dcb07038e6b7368 (patch)
tree6747ac3e35ef28530b7ff83b27a272607a724ac1 /railties/lib/rails
parent71abfa511da77109b2bbf913dcee2f9e1606e66a (diff)
downloadrails-3663057518eb9acf9b1e72f47dcb07038e6b7368.tar.gz
rails-3663057518eb9acf9b1e72f47dcb07038e6b7368.tar.bz2
rails-3663057518eb9acf9b1e72f47dcb07038e6b7368.zip
Merge pull request #7587 from elia/fix-too-eager-loading
Should not eager_load app/assets Conflicts: railties/CHANGELOG.md
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/paths.rb18
1 files changed, 12 insertions, 6 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb
index 8af4130e87..cfdb15a14e 100644
--- a/railties/lib/rails/paths.rb
+++ b/railties/lib/rails/paths.rb
@@ -99,14 +99,15 @@ module Rails
protected
def filter_by(constraint)
- all = []
+ yes = []
+ no = []
+
all_paths.each do |path|
- if path.send(constraint)
- paths = path.existent
- paths -= path.children.map { |p| p.send(constraint) ? [] : p.existent }.flatten
- all.concat(paths)
- end
+ paths = path.existent + path.existent_base_paths
+ path.send(constraint) ? yes.concat(paths) : no.concat(paths)
end
+
+ all = yes - no
all.uniq!
all
end
@@ -134,6 +135,7 @@ module Rails
keys.delete(@current)
@root.values_at(*keys.sort)
end
+ deprecate :children
def first
expanded.first
@@ -210,6 +212,10 @@ module Rails
expanded.select { |d| File.directory?(d) }
end
+ def existent_base_paths
+ map { |p| File.expand_path(p, @root.path) }.select{ |f| File.exist? f }
+ end
+
alias to_a expanded
end
end