Chapter 5. Nested resources

This chapter covers

  • Building a nested resource
  • Declaring data associations between two database tables
  • Working with objects within an association

With the project resource CRUD done, the next step is to set up the ability to create tickets within the scope of a given project. The term for performing actions for objects within the scope of another object is nesting. This chapter explores how to set up nested routing for Ticket resources by creating a CRUD interface for them, scoped underneath the projects resource that you just created.

5.1. Creating tickets

To add the functionality to create tickets underneath the projects, you first develop the Cucumber features and then implement the code required to make ...

Get Rails 3 in Action now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.