IT 231 Web Development I
Fall 2011

Assignment 3
Creating non-scaffolded controllers and views
Due Sunday October 2 by 11:30 PM

Overview

For this project, you will add a new controller and view to a scaffolded application. This controller and view will present a summary report of the database contents for your application.

The assignment addresses the following goals:

  1. Adding a method to the model class
  2. Creating a controller and view
  3. Assigning instance variables in the controller
  4. Presenting dynamic content in a view
  5. Using CSS to format a page
  6. Matching a route to a controller and action

Scaffold creation

This project requires the use of a scaffolded application. You may want to use the same application from the last week.

New model method

Create a new model method and add it to your model file. This method (perhaps called 'description') returns a summary description of an instance belonging to the model. We'll go over an example in class.

New controller and view

Create a new controller called 'report' and a view called 'summary'. This step can be completed with one command:

rails generate controller report summary

Check the routes.rb file (in the config folder) and verify that a new route has been created. You can also run the application to see if the dummy page is working.

View presentation

Write code to the new controller and view so that it presents the following information:

You are strongly encouraged to add additional information to your view. Examples might include the date of when the last record was added or a listing showing records that meet a specific condition.

Finally, use CSS to provide some formatting to your view.

Report

Using any word processor, write a short summary document that describes your efforts for this assignment. The summary document should include the following:

Submission

Place the summary document in your rails application folder. Zip up the folder. Submit the zip file using D2L.

Grading

This project is worth 20 points:

Submissions are eligible for partial credit. Always submit an assignment even if it is not complete.