Chapter 4. Controllers

Rails controllers connect your application’s models and views. Any web requests that your application receives are routed to the appropriate controller. The controller gets data from the model and then renders the appropriate view or redirects to a different location.

In this chapter, we continue working on our blog. Along the way, you’ll learn about controllers in detail. I’ll cover resource representation with REST, routing resources, and the types of actions a controller can take.

Representational State Transfer

Representational State Transfer, or REST, is a client-server software architecture introduced in 2000 by Dr. Roy Fielding, one of the authors of the HTTP specification. REST deals with the representation ...

Get Rails Crash Course 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.