Class

Configuration

Extends:

The Configuration class holds all the parameters for the Initializer and ships with defaults that suites most Rails applications. But it’s possible to overwrite everything. Usually, you’ll create an Configuration file implicitly through the block running on the Initializer, but it’s also possible to create the Configuration instance in advance and pass it in like this:

config = Rails::Configuration.new
Rails::Initializer.run(:process, config)
Public Attributes
action_controller A stub for setting options on ActionController::Base
action_mailer A stub for setting options on ActionMailer::Base
action_view A stub for setting options on ActionView::Base
active_record A stub for setting options on ActiveRecord::Base
active_resource A stub for setting options on ActiveRecord::Base
cache_classes Whether or not classes should be cached (set to false if you want application classes to be reloaded on each request)
cache_store The specific cache store to use. By default, the ActiveSupport::Cache::Store will be used.
controller_paths The list of paths that should be searched for controllers. (Defaults to app/controllers and components.)
database_configuration_file The path to the database configuration file to use. (Defaults to config/database.yml.)
frameworks The list of rails framework components that should be loaded. (Defaults to :active_record, :action_controller, :action_view, :action_mailer, and :active_resource).
load_once_paths An array of paths from which Rails will automatically load from only once. All elements of this array must also be in load_paths.
load_paths An array of additional paths to prepend to the load path. By default, all app, lib, vendor and mock paths are included in this list.
log_level The log level to use for the default Rails logger. In production mode, this defaults to :info. In development mode, it defaults to :debug.
log_path The path to the log file to use. Defaults to log/#{environment}.log (e.g. log/development.log or log/production.log).
logger The specific logger to use. By default, a logger will be created and initialized using #log_path and #log_level, but a programmer may specifically set the logger to use via this accessor and it will be used directly.
plugin_loader The class that handles loading each plugin. Defaults to Rails::Plugin::Loader, but a sub class would have access to fine grained modification of the loading behavior. See the implementation of Rails::Plugin::Loader for more details.
plugin_locators The classes that handle finding the desired plugins that you’d like to load for your application. By default it is the Rails::Plugin::FileSystemLocator which finds plugins to load in vendor/plugins. You can hook into gem location by subclassing Rails::Plugin::Locator and adding it onto the list of plugin_locators.
plugin_paths The path to the root of the plugins directory. By default, it is in vendor/plugins.
plugins The list of plugins to load. If this is set to nil, all plugins will be loaded. If this is set to [], no plugins will be loaded. Otherwise, plugins will be loaded in the order specified.
root_path The application’s base directory.
time_zone Sets the default time_zone. Setting this will enable time_zone awareness for ActiveRecord models and set the ActiveRecord default timezone to :utc.
view_path The root of the application’s views. (Defaults to app/views.)
whiny_nils Set to true if you want to be warned (noisily) when you try to invoke any method of nil. Set to false for the standard Ruby behavior.
Public Methods
after_initialize Adds a block which will be executed after rails has been fully initialized. Useful for per-environment configuration which depends on the framework being fully initialized.
after_initialize_blocks Returns the blocks added with Configuration#after_initialize
breakpoint_server Deprecated options:
breakpoint_server= Alias for #breakpoint_server
builtin_directories
database_configuration Loads and returns the contents of the #database_configuration_file. The contents of the file are processed via ERB before being sent through YAML::load.
environment Return the currently selected environment. By default, it returns the value of the RAILS_ENV constant.
environment_path The path to the current environment’s file (development.rb, etc.). By default the file is at config/environments/#{environment}.rb.
framework_paths
new Create a new Configuration instance, initialized with the default values.
plugins=
set_root_path! Set the root_path to RAILS_ROOT and canonicalize it.
to_prepare Add a preparation callback that will run before every request in development mode, or before the first request in production.
Private Methods
default_cache_classes
default_cache_store
default_controller_paths
default_database_configuration_file
default_dependency_mechanism
default_frameworks
default_load_once_paths Doesn’t matter since plugins aren’t in load_paths yet.
default_load_paths
default_log_level
default_log_path
default_plugin_loader
default_plugin_locators
default_plugin_paths
default_plugins
default_view_path
default_whiny_nils
framework_root_path
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.