Reusing database.yml Sections

In order to reuse database.yml sections for your database connection information, you can do the following in your database.yml file.

Notice the use of &development which creates a tag which can be referenced later within your database.yml file.

development: &development
   adapter: sqlite3
   database: db/development.sqlite3

   <<: *development

You can also do something like this, which assigns the &login tag which is later referenced within the development section:

login: &login
   username: myusername
   password: mypassword

   adapter: mysql
   host: localhost
   database: development_db
   <<: *login
VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Facebook Twitter Email

Leave a Reply