Action Pack: The View and Controller
Explore the role of Action Pack in Rails, focusing on how views and controllers interact within the MVC architecture. Understand how to create dynamic content using Embedded Ruby templates and how controllers coordinate application logic including routing, caching, and session management.
We'll cover the following...
Generally, the view and controller parts of MVC are intimately connected. The controller supplies data to the view, and the controller receives events from the pages generated by the views. Because of these interactions, the support for views and controllers in Rails is bundled into a single component called Action Pack.
Don’t be fooled into thinking that our application’s view code and controller code will be jumbled up because Action Pack is a single component. Quite the opposite is true, actually, as Rails gives us the separation we need to write web applications with clearly demarcated code for control and presentation logic.