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)?
KeywordsRegular Expression Post Controller Controller Action Edit Action Custom Route
Unable to display preview. Download preview PDF.