diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-15 06:40:39 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-15 06:40:39 +0000 |
commit | 40b7809de5394b1dd9ed29875131c880b65ff766 (patch) | |
tree | 752a2dbe2f794bedf9490d81b9b174a9e94f5692 /railties | |
parent | 5dbf5ded5c5978b8ee87044c34c3e6ca6fc381a1 (diff) | |
download | rails-40b7809de5394b1dd9ed29875131c880b65ff766.tar.gz rails-40b7809de5394b1dd9ed29875131c880b65ff766.tar.bz2 rails-40b7809de5394b1dd9ed29875131c880b65ff766.zip |
Added check for RAILS_CONNECTION_ADAPTERS on startup and only load the connection adapters specified within if its present (available in Rails through config.connection_adapters using the new config) #1958 [skae]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2248 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties')
-rw-r--r-- | railties/environments/environment.rb | 3 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/railties/environments/environment.rb b/railties/environments/environment.rb index f8b95505cf..14654dff00 100644 --- a/railties/environments/environment.rb +++ b/railties/environments/environment.rb @@ -18,6 +18,9 @@ Rails::Initializer.run do |config| # (by default production uses :info, the others :debug) # config.log_level = :debug + # Only include the connection adapters you're actually going to use + # config.connection_adapters = %w( mysql sqlite ) + # Use the database for sessions instead of the file system # (create the session table with 'rake create_sessions_table') # config.action_controller.session_store = :active_record_store diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 8e99c708c2..5b80ab5bd5 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -30,6 +30,7 @@ module Rails def process set_load_path + set_connection_adapters require_frameworks load_environment @@ -56,6 +57,10 @@ module Rails $LOAD_PATH.uniq! end + def set_connection_adapters + RAILS_CONNECTION_ADAPTERS = configuration.connection_adapters + end + def require_frameworks configuration.frameworks.each { |framework| require(framework.to_s) } end @@ -143,6 +148,7 @@ module Rails class Configuration attr_accessor :frameworks, :load_paths, :logger, :log_level, :log_path, :database_configuration_file, :view_path, :controller_paths attr_accessor :cache_classes, :breakpoint_server, :whiny_nils + attr_accessor :connection_adapters attr_accessor :active_record, :action_controller, :action_view, :action_mailer, :action_web_service def initialize @@ -155,6 +161,7 @@ module Rails self.cache_classes = default_cache_classes self.breakpoint_server = default_breakpoint_server self.whiny_nils = default_whiny_nils + self.connection_adapters = default_connection_adapters self.database_configuration_file = default_database_configuration_file for framework in default_frameworks @@ -258,5 +265,9 @@ module Rails def default_whiny_nils false end + + def default_connection_adapters + %w(mysql postgresql sqlite sqlserver db2 oci) + end end end |