Ruby On Rails Lesson
1. Add tests for destroying relationships associated with a given user (i.e., as implemented by dependent :destroy in Listing 11.4 and Listing 11.16). Hint: Follow the example in Listing 10.15.
2. The respond_to method seen in Listing 11.38 can actually be hoisted out of the actions into the Relationships controller itself, and the respond_to blocks can be replaced with a Rails method called respond_with. Prove that the resulting code, shown in Listing 11.47, is correct by verifying that the test suite still passes. (For details on this method, do a Google search on ‘‘rails respond with’’.)
3. Refactor Listing 11.31 by adding partials for the code common to the following/ followers pages, the Home page, and the user show page.
4. Following the model in Listing 11.19, write tests for the stats on the profile page.