Skip to Content
Ruby on Rails® for Microsoft Developers
book

Ruby on Rails® for Microsoft Developers

by Antonio Cangiano
April 2009
Intermediate to advanced content levelIntermediate to advanced
479 pages
12h 55m
English
Wrox
Content preview from Ruby on Rails® for Microsoft Developers

Chapter 8. Handling Requests with ActionController

Rails is the most well thought-out web development framework I've ever used. And that's in a decade of doing web applications for a living. I've built my own frameworks, helped develop the Servlet API, and have created more than a few web servers from scratch. Nobody has done it like this before.

—James Duncan Davidson, Creator of Tomcat and Ant

ActionController is a key module used by Rails to handle incoming requests by mapping them with, and handing over control to, specific public instance methods known as actions. ActionController works closely with ActionView to formulate a proper response for each request, and together they form a powerful framework known as ActionPack.

The process of going from an incoming request to a complete response that's sent back to the user's browser can be divided into three logical steps: routing the request to determine which action should handle it; executing the code of the action; and finally rendering a template in the view layer. The first two steps are managed by ActionController and, together with testing, are the main subject of this chapter.

When a request comes in, ActionController uses a routing component that looks up the routes defined for the project to determine which controller and action should handle the incoming request. As soon as the controller has been identified, its class is instantiated. The details of the incoming request and a new response object are then passed to ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Ruby on Rails™ 3 Tutorial: Learn Rails™ by Example

Ruby on Rails™ 3 Tutorial: Learn Rails™ by Example

Michael Hartl

Publisher Resources

ISBN: 9780470374955Purchase book