1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Revert "Merge pull request #7587 from elia/fix-too-eager-loading"

This reverts commit 3663057518.

REASON: This caused a regression that add app folder in the eager load
path. See #8146 for more information.

Conflicts:
	railties/CHANGELOG.md
This commit is contained in:
Rafael Mendonça França 2012-12-18 16:05:30 -03:00
parent e4003adff9
commit 7f96e4317e
3 changed files with 6 additions and 17 deletions

View file

@ -38,8 +38,6 @@
* Ensure that `RAILS_ENV` is set when accessing Rails.env *Steve Klabnik*
* Don't eager-load `app/assets` and `app/views` *Elia Schito*
* Add `.rake` to list of file extensions included by `rake notes` and `rake notes:custom`. *Brent J. Nordquist*
* New test locations `test/models`, `test/helpers`, `test/controllers`, and

View file

@ -99,15 +99,14 @@ module Rails
protected
def filter_by(constraint)
yes = []
no = []
all = []
all_paths.each do |path|
paths = path.existent + path.existent_base_paths
path.send(constraint) ? yes.concat(paths) : no.concat(paths)
if path.send(constraint)
paths = path.existent
paths -= path.children.map { |p| p.send(constraint) ? [] : p.existent }.flatten
all.concat(paths)
end
end
all = yes - no
all.uniq!
all
end
@ -135,7 +134,6 @@ module Rails
keys.delete(@current)
@root.values_at(*keys.sort)
end
deprecate :children
def first
expanded.first
@ -212,10 +210,6 @@ 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

View file

@ -59,8 +59,6 @@ module ApplicationTests
assert eager_load.include?(root("app/controllers"))
assert eager_load.include?(root("app/helpers"))
assert eager_load.include?(root("app/models"))
assert !eager_load.include?(root("app/views")), "expected to not be in the eager_load_path"
assert !eager_load.include?(root("app/assets")), "expected to not be in the eager_load_path"
end
test "environments has a glob equal to the current environment" do
@ -75,7 +73,6 @@ module ApplicationTests
assert_in_load_path "vendor"
assert_not_in_load_path "app", "views"
assert_not_in_load_path "app", "assets"
assert_not_in_load_path "config"
assert_not_in_load_path "config", "locales"
assert_not_in_load_path "config", "environments"