Controlling Our Routing


At this point in the book, we’ve completed a nice high-level tour of each leg of the MVC architecture and how Rails supports it using the ActiveRecord and the ActionPack libraries. Along the way, we even touched a little on how those three elements work together as we’ve built some simple forms and looked at how controllers serve as the bridge between model data and views. But we’ve merely breezed by one area in those discussions: understanding how Rails determines the way to map web requests to those components. In other words, how does Rails know to map a URL like http://localhost:3001/posts/edit/23 to the edit action in the posts controller (setting the id parameter to 23 for the ActiveRecord find)?


Regular Expression Post Controller Controller Action Edit Action Custom Route 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Copyright information

© Eldon Alameda 2008

Personalised recommendations