Who Controls the Controller?
All our new tests pass, so letâs take stock. We still have one test pendingâour end-to-end test still doesnât like that the create action canât be found in the ProjectsController. Now we have all the pieces we need to write that action.
Since weâve put our business logic in the action object, the controller doesnât have much logic, but it does have some. Specifically, the controller sends data to both the action object and onward to the view layer. Although we havenât stressed the point, the controller also needs to do something in case the action object errors or does something else unexpected. Notice that weâve separated responsibilities hereâalmost nothing that the controller does is dependent ...
Get Rails 4 Test Prescriptions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.