Skip to content

Commit

Permalink
Remove the uncanny default of adding all app/models/*/ directories to…
Browse files Browse the repository at this point in the history
… the load path. References #6031.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5064 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
seckar committed Sep 7, 2006
1 parent a5df861 commit e3c2151
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
7 changes: 7 additions & 0 deletions railties/CHANGELOG
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
20 changes: 14 additions & 6 deletions railties/lib/initializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,18 @@ class Configuration
# 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.
Expand Down Expand Up @@ -551,9 +563,7 @@ def default_load_paths
# 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.
Expand Down Expand Up @@ -591,9 +601,7 @@ def default_autoload_paths
# 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.
Expand Down

0 comments on commit e3c2151

Please sign in to comment.