Listing 10-8. Routes File (config/routes.rb)
ActionController::Routing::Routes.draw do |map|
map.root :controller=>'home'
map.connect ':controller/:action/:id.:format' # These two routes are
map.connect ':controller/:action/:id' # created by Rails.
end
This code connects /??”the root of the server??”to the home controller. Since you didn??™t
specify an action, it uses the index action. Note that the public/index.html file overrides
this route, though, so delete the public/index.html file now.
Setting Up the Database and Schema
Next, let??™s create a database for this application:
mysqladmin ??“u root -p create apache_sales_tracker
At this point, you need to modify config/database.yml to reflect your database connection
parameters. Edit it and replace the default values with the correct values for your
machine.
CHAPTER 10 n CALCULATING COSTS BY ANALYZING APACHE WEB LOGS 201
The next step is to build a schema for the application, as shown in Listing 10-9.
Listing 10-9. Database Initial Schema Migration (db/migrate/001_initial_schema.
Pages:
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291