Well it is spread across the rails framework with which will be developing an application. I will be reminding whenever it's put in use.
In previous post, I did stress on how simple it would be in configuring the databases and tables with your application. In Java based applications, this would be done using lot of xml files, which is of course, time taking, lot of repetitive work and error prone... (at least that's what my friend's used to say!).
Well in rails this is not the case a simple convention that you follow would ensure of configuring the tables of databases.
"You name the tables in database as plurals and create classes with singular form of the table names."Configuring the Databases:
The choice of which database you use the configuration and respective adapter would depend on. When we created an application, there is a set of predefined folders created over a simple command! (I will touch upon this later). "config" is one such folder and under this we will now concentrate/repair on "database.yml".
Rails would automatically create 3 different environments:
- Development
- Test
- Production
This file contains the information relate to the adapter, database, user credentials, host, port...
This does make sense in a way, the plural form for tables will fit as it contains huge data and the respective class which we would be placed under app/models, with the extension ".rb" is named in singular form.
development:
adapter: mysql
database: dummy
username: root
password:
host: localhost
What it means?
Our application is connected to MySQL database by name dummy, user being and root and with an empty password. The host environment is "localhost".
To Be Continued...
No comments:
Post a Comment