In
Rolling with
Ruby on Rails, I barely scratched the surface of what you can do with Ruby
on Rails. I didn't talk about data validation or database transactions, and I
did not mention callbacks, unit testing, or caching. There was hardly a mention
of the many helpers that Rails includes to make your life easier. I can't really
do justice to all of these topics in the space of this article, but I will go
into details on some of them and present a brief overview of the
rest, with links to more detailed information.
Also, I purposely did not go into any detail about the Ruby programming
language. If you are interested in a brief treatment of the whys behind the
Ruby and Rails code that you saw in Part 1, then I highly recommend reading Amy Hoy's blog entry Really
Getting Started in Rails.
Before I cover this stuff, I want to complete the homework items from the end of Part 1:
- There is no longer any way to delete a recipe. Add a delete button (or
link) to the edit template.
- On the main recipes page, there aren't any links for the pages that let you
manipulate categories. Fix that.
- It would be nice to have a way to display only those recipes in a
particular category. For example, maybe I'd like to see a list of all snack
recipes, or all beverage recipes. On the page that lists all recipes,
make each category name a link to a page that will display all of the recipes
in that category.
One alert reader pointed out that after adding categories, it was no longer
possible to add any new recipes because the new recipe action (as
provided by the scaffolding) had no way to assign a category, and this caused
the list recipes action to produce an error. This also needs
fixing.