| | |||||||
| |||||||
| |||||||
|
|
|
|
|
|
|
User Stories for a Book Inventory Management System(Page 1 of 2 ) In this eighth part of a twelve-part series on the scaffolding feature of Ruby on Rails, we'll start implementing the front end of our book inventory management system. This article is excerpted from chapter three of the book Practical Rails Projects, written by Eldon Alameda (Apress; ISBN: 1590597818). Generating Book Administration Code with the Scaffolding Script With both the database schema and ActiveRecord model in place, we are now ready to start implementing the front-end. The requirements for book administration include five user stories: Add Book, Upload Book Cover, View Book, Edit Book, and Delete Book. Tip It’s good practice to run all your tests—including unit, integration, and functional—after you make any big changes, as we have done in this chapter. This can be done by running therakecommand without specifying any parameters. However, at this point, it will throw an error. You can fix this by adding the lineconfig.active_record.schema_format = :sqltoconfig/environment.rb. As with the publisher administration interface, we use scaffolding to create the controller, model, and view files by executing thegeneratescript: $ script/generate scaffold Book 'admin/book'
You can delete thepublic/stylesheets/scaffold.cssfile, because you already have a style sheet. Note that the generated functional test will fail if you execute it. You can decide whether to keep it or You can delete the public/stylesheets/scaffold.css file, because you already have a style sheet. Note that the generated functional test will fail if you execute it. You can decide whether to keep it or delete it, but we deleted it by executing the following command: $ rm test/functional/admin/book_controller_test.rb Now we’ll introduce you to integration tests, which we’ll use to test the front-end instead of functional tests. More Database Articles Articles |
| |
| |