aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorElia Schito <elia@schito.me>2012-10-27 14:05:02 +0200
committerElia Schito <elia@schito.me>2012-10-28 00:27:11 +0200
commit53778ec2d716f860646fd43957fd53c8db4da2fe (patch)
tree4bf727ee38aafd31a48801e66ce8ad839a010c5f /railties
parent552a3e145373cabe25a78d8d7cba2ceaabd9ecc5 (diff)
downloadrails-53778ec2d716f860646fd43957fd53c8db4da2fe.tar.gz
rails-53778ec2d716f860646fd43957fd53c8db4da2fe.tar.bz2
rails-53778ec2d716f860646fd43957fd53c8db4da2fe.zip
Respect children paths filter settings
E.g. don't eager-load app/assets even if app/* has the eager_load flag set.
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md2
-rw-r--r--railties/lib/rails/paths.rb17
2 files changed, 13 insertions, 6 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index 27f4fd6de7..b3b1633089 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,5 +1,7 @@
## Rails 3.2.9 (unreleased)
+* Don't eager-load app/assets and app/views *Elia Schito*
+
* Update supported ruby versions error message in ruby_version_check.rb *Lihan Li*
## Rails 3.2.8 (Aug 9, 2012) ##
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb
index 4ac3d88dc2..17eba4c69c 100644
--- a/railties/lib/rails/paths.rb
+++ b/railties/lib/rails/paths.rb
@@ -87,14 +87,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
@@ -194,6 +195,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
private