This project is archived and is in readonly mode.

#312 ✓ wontfix
Adam Keys

Database config in Ruby

Reported by Adam Keys | June 3rd, 2008 @ 06:53 AM

This patch allows a developer to configure their database via Ruby in addition to the existing database.yml. First, one specifies the path to the Ruby file:

config.database_configuration_file = 'config/database.rb'

Then, you set up your database in @database.rb@:

Rails::DatabaseSpecGenerator.map do |db|
  db.development :config => 
    {:adapter => 'sqlite3', 
     :database => 'db/development.sqlite3', 
     :timeout => 5000}
  db.test :config => 
    {:adapter => 'sqlite3', 
     :database => 'db/test.sqlite3', 
     :timeout => 5000}
  db.production :config => 
    {:adapter => 'sqlite3', 
     :database => 'db/production.sqlite3', 
     :timeout => 5000}
end

This patch does not yet generate config/database.rb by default, nor does it prevent you from using config/database.yml.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Tickets have moved to Github

The new ticket tracker is available at https://github.com/rails/rails/issues

Shared Ticket Bins

Pages