diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-09-07 16:53:58 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-09-07 16:53:58 +0000 |
commit | e3c2151f7f0b996e0a024baed9e4da3f3b7338f4 (patch) | |
tree | 4e19f1d71ab5caff03efc37cb0a34e31faa1988c | |
parent | a5df861852db69c8449b1d9a9a15a56a7b09abcb (diff) | |
download | rails-e3c2151f7f0b996e0a024baed9e4da3f3b7338f4.tar.gz rails-e3c2151f7f0b996e0a024baed9e4da3f3b7338f4.tar.bz2 rails-e3c2151f7f0b996e0a024baed9e4da3f3b7338f4.zip |
Remove the uncanny default of adding all app/models/*/ directories to the load path. References #6031.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | railties/CHANGELOG | 7 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 20 |
2 files changed, 21 insertions, 6 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG index c53b26deb5..4403e58474 100644 --- a/railties/CHANGELOG +++ b/railties/CHANGELOG @@ -1,5 +1,12 @@ *SVN* +* Remove the uncanny default of adding all app/models/*/ directories to the load path. This change will break application which expect the current behavior. As +documented in initializer.rb, the workaround is: + + config.autoload_paths += Dir[RAILS_ROOT + '/app/models/*/'] + +References #6031. [Nicholas Seckar]. + * Update to script.aculo.us 1.6.3 [Thomas Fuchs] * Update to Prototype 1.5.0_rc1 [sam] diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index e4c55023f1..d48f6fb23f 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -434,6 +434,18 @@ module Rails # An array of paths from which Rails will automatically load classes and # modules from. By default, all +app+, +lib+, +vendor+ and mock paths are # included in this list. + # + # To automatically load constants from a directory, add it to this array. For + # example, if you organize your models in subdirectories (not modules), you + # would add: + # + # config.autoload_paths += Dir[RAILS_ROOT + '/app/models/*/'] + # + # and if you do not have any models in the root of app/models, you would + # also want: + # + # config.autoload_paths.remove RAILS_ROOT + '/app/models' + # attr_accessor :autoload_paths # An array of paths from which Rails will automatically load from only once. @@ -551,9 +563,7 @@ module Rails # Add the app's controller directory paths.concat(Dir["#{root_path}/app/controllers/"]) - # Then model subdirectories. - # TODO: Don't include .rb models as load paths - paths.concat(Dir["#{root_path}/app/models/[_a-z]*"]) + # Then components subdirectories. paths.concat(Dir["#{root_path}/components/[_a-z]*"]) # Followed by the standard includes. @@ -591,9 +601,7 @@ module Rails # Add the app's controller directory paths.concat(Dir["#{root_path}/app/controllers/"]) - # Then model subdirectories. - # TODO: Don't include .rb models as load paths - paths.concat(Dir["#{root_path}/app/models/[_a-z]*"]) + # Then component subdirectories. paths.concat(Dir["#{root_path}/components/[_a-z]*"]) # Followed by the standard includes. |