Chapter 1. Ruby on Rails, the framework
Listing 1.1. db/migrate/[date]_create_purchases.rb
Listing 1.2. app/views/purchases/new.html.erb
Listing 1.3. The first half of app/views/purchases/_form.html.erb
Listing 1.4. The new action of PurchasesController
Listing 1.5. The second half of app/views/purchases/_form.html.erb
Listing 1.6. The create action of PurchasesController
Listing 1.7. app/models/purchase.rb
Listing 1.8. app/views/purchases/show.html.erb
Listing 1.9. The show action of PurchasesController
Listing 1.10. The set_purchase before_action in PurchasesController
Listing 1.11. config/routes.rb
Listing 1.12. HTML source of app/views/purchases/new.html.erb
Listing 1.13. app/views/purchases/edit.html.erb
Listing 1.14. The edit action of PurchasesController
Listing 1.15. Rendered HTML for app/views/purchases/edit.html.erb
Listing 1.16. The update action of PurchasesController
Listing 1.17. app/views/purchases/index.html.erb
Listing 1.18. The destroy action of PurchasesController
Chapter 2. Testing saves your bacon
Listing 2.1. chapter_2/example_test.rb
Listing 2.2. chapter_2/example_test.rb, alternate truth test
Listing 2.3. chapter_2/bacon_test.rb
Listing 2.4. chapter_2/bacon_test.rb, now with Bacon class
Listing 2.5. Bacon class in chapter_2/bacon_test.rb
Listing 2.6. bacon/spec/bacon_spec.rb
Listing 2.7. An alternate way to check if Bacon is edible
Listing 2.8. bacon/lib/bacon.rb
Listing 2.9. bacon/lib/bacon.rb
Listing 2.10. bacon/lib/bacon.rb
Listing 2.11. bacon/lib/bacon.rb