Creating the Web Interface
Begin the Rails application by creating the framework:
rails training_app
create app/controllers
create app/helpers
create app/models
create app/views/layouts
create config/environments
create components
create db
create doc
create lib
. . .
create log/production.log
create log/development.log
create log/test.log
Next, create the first controller for this application, which will contain the main page
of the application:
CHAPTER 12 n CREATING REPORTS WITH RUBY AND MICROSOFT OFFICE 237
cd training_app
ruby script/generate controller homepage
exists app/controllers/
exists app/helpers/
create app/views/homepage
exists test/functional/
create app/controllers/homepage_controller.rb
create test/functional/homepage_controller_test.rb
create app/helpers/homepage_helper.rb
Now add the code for the home page controller, shown in Listing 12-2.
Listing 12-2. Homepage Controller (app/controllers/homepage_controller.rb)
class HomepageController < ApplicationController
def index
end
end
Save this file as app/controllers/homepage_controller.
Pages:
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343