mirror of https://github.com/rails/rails
Added config/initializers where all ruby files within it are automatically loaded after the Rails configuration is done, so you don't have to litter the environment.rb file with a ton of mixed stuff [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6212 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
b50a05cac3
commit
c6d6082562
|
@ -1,5 +1,7 @@
|
|||
*SVN*
|
||||
|
||||
* Added config/initializers where all ruby files within it are automatically loaded after the Rails configuration is done, so you don't have to litter the environment.rb file with a ton of mixed stuff [DHH]
|
||||
|
||||
* For new apps, generate a random secret for the cookie-based session store. [Jeremy Kemper]
|
||||
|
||||
* Stop swallowing errors during rake test [Koz]
|
||||
|
|
|
@ -38,9 +38,27 @@ Rake::TestTask.new("regular_test") do |t|
|
|||
end
|
||||
|
||||
|
||||
BASE_DIRS = %w(
|
||||
app config/environments components db doc log lib lib/tasks public script script/performance script/process test vendor vendor/plugins
|
||||
tmp/sessions tmp/cache tmp/sockets tmp/pids
|
||||
BASE_DIRS = %w(
|
||||
app
|
||||
config/environments
|
||||
config/initializers
|
||||
components
|
||||
db
|
||||
doc
|
||||
log
|
||||
lib
|
||||
lib/tasks
|
||||
public
|
||||
script
|
||||
script/performance
|
||||
script/process
|
||||
test
|
||||
vendor
|
||||
vendor/plugins
|
||||
tmp/sessions
|
||||
tmp/cache
|
||||
tmp/sockets
|
||||
tmp/pids
|
||||
)
|
||||
|
||||
APP_DIRS = %w( models controllers helpers views views/layouts )
|
||||
|
|
|
@ -49,19 +49,7 @@ Rails::Initializer.run do |config|
|
|||
# config.active_record.default_timezone = :utc
|
||||
|
||||
# See Rails::Configuration for more options
|
||||
end
|
||||
|
||||
# Add new inflection rules using the following format
|
||||
# (all these examples are active by default):
|
||||
# Inflector.inflections do |inflect|
|
||||
# inflect.plural /^(ox)$/i, '\1en'
|
||||
# inflect.singular /^(ox)en/i, '\1'
|
||||
# inflect.irregular 'person', 'people'
|
||||
# inflect.uncountable %w( fish sheep )
|
||||
# end
|
||||
|
||||
# Add new mime types for use in respond_to blocks:
|
||||
# Mime::Type.register "text/richtext", :rtf
|
||||
# Mime::Type.register "application/x-mobile", :mobile
|
||||
|
||||
# Include your application configuration below
|
||||
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory is automatically loaded
|
||||
end
|
|
@ -70,6 +70,8 @@ module Rails
|
|||
# * #load_plugins
|
||||
# * #load_observers
|
||||
# * #initialize_routing
|
||||
# * #after_initialize
|
||||
# * #load_application_initializers
|
||||
#
|
||||
# (Note that #load_environment is invoked twice, once at the start and
|
||||
# once at the end, to support the legacy configuration style where the
|
||||
|
@ -112,6 +114,8 @@ module Rails
|
|||
|
||||
# the framework is now fully initialized
|
||||
after_initialize
|
||||
|
||||
load_application_initializers
|
||||
end
|
||||
|
||||
# Check for valid Ruby version
|
||||
|
@ -334,6 +338,12 @@ module Rails
|
|||
configuration.after_initialize_block.call if configuration.after_initialize_block
|
||||
end
|
||||
|
||||
def load_application_initializers
|
||||
Dir["#{RAILS_ROOT}/config/initializers/**/*.rb"].each do |initializer|
|
||||
load(initializer)
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
# Return a list of plugin paths within base_path. A plugin path is
|
||||
# a directory that contains either a lib directory or an init.rb file.
|
||||
|
|
|
@ -121,6 +121,7 @@ class AppGenerator < Rails::Generator::Base
|
|||
app/models
|
||||
app/views/layouts
|
||||
config/environments
|
||||
config/initializers
|
||||
db
|
||||
doc
|
||||
lib
|
||||
|
|
Loading…
Reference in New Issue