Completing a Book Inventory Management System
In this conclusion to a 12-part article series on building a book inventory management system with the scaffolding feature of Ruby on Rails, we'll finish the View Book User and Edit Book User stories. This article is excerpted from chapter three of the book Practical Rails Projects , written by Eldon Alameda (Apress; ISBN: 1590597818). Completing the View Book User Story The View Book user story also needs some cleaning up before George is happy. The code created by the scaffolding displays the values of all database columns directly to the user. This means, for example, that the publisher’s ID is shown instead of the publisher’s name. We’ll fix this and also add code that displays the authors of the book and the book cover. Changing the View First, change app/views/admin/book/show.rhtml as follows: <dl> <dt>Title</dt> <dd><%= @book.title %></dd> <dt>Publisher</dt> <dd><%= @book.publisher.name %></dd> ...