Prev | Current Page 118 | Next

David Berube

"Practical Reporting with Ruby and Rails"

After that, you can
use a Rails mechanism called migrations to create the database tables for you. Edit the
config/database.yml file to read as shown in Listing 5-1.
Listing 5-1. Database Configuration File for the Web Report (config/database.yml)
development:
adapter: mysql
database: actor_schedule_development
username: your_user_name
password: your_password
host: localhost
Note that Rails creates three database connection settings by default, but this
example uses only the development environment to keep things simple. The other environments
are testing, used for automated testing, and production, used for deployment.
Additionally, the default file includes a number of comments, which I??™ve removed from
the listing for the sake of brevity.
Next, you need to create a new migration.
Creating a Migration
Migrations are bits of Ruby code that control the structure of a database. Each migration
represents a set of changes to a database. The first migration usually specifies the initial
structure of a database, and each successive version represents a change of some kind??”
adding a column, setting a default value, renaming a table, and so forth.


Pages:
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
aquilamed Spa Ciechocinek drzwiowe hosting hotele londyn