Rails' connection to database is specified in config/database.yml There are 3 section, which usually use the same login and password. We can share login information as the following example:
Rails ใช้ข้อมูลในแฟ้ม config/database.yml เป็นตัวกำหนด การติดต่อฐานข้อมูล โดยปรกติจะมี 3 ส่วนที่ใช้ข้อมูล login ร่วมกัน เราสามารถกำหนดให้ข้อมูล login ใช้ร่วมกันได้ดังนี้
--- database.yml ---
login: &login
adapter: mysql
host: localhost
username: mylogin
password: mypassword
development:
database: database_for_development
<<: *login
test:
database: database_for_test
<<: *login
production:
database: database_for_production
<<: *login