Database.yml configuration options

I would like to know where I can read about valid configuration options for database.yml for ActiveRecord. I know the basic ones, such as adapter, database, username, password, etc., but I would like to have a complete list for each adapter. Where can i find this?

+4
source share
1 answer

I found the essence of database.yml examples using mysql, postgres and sqlite3, and the Rails 3.2 source code for connection adapters also gives a good idea.

Considers the following most commonly used options:

  • Adapter
  • Encoding
  • Database
  • swimming pool
  • Username
  • password
  • socket
  • host
  • Port
  • Time-out

The Rails 3.2 connection_specification.rb file looks like it simply combines any parameters that you include, so I would say which options you include on the database adapter that you decide to use (lines 58-74):

def connection_url_to_hash(url) # :nodoc: config = URI.parse url adapter = config.scheme adapter = "postgresql" if adapter == "postgres" spec = { :adapter => adapter, :username => config.user, :password => config.password, :port => config.port, :database => config.path.sub(%r{^/},""), :host => config.host } spec.reject!{ |_,value| !value } if config.query options = Hash[config.query.split("&").map{ |pair| pair.split("=") }].symbolize_keys spec.merge!(options) end spec end 
+4
source

All Articles