9
Bringing It All Together
So far, we have seen how to use controllers, views, and models in a somewhat detached manner. In the previous chapter (Models, Databases, and Active Record), we manipulated data on our database. However, we didn’t see how to interact with the database data from our controller, much less how to load that database data into our view. In this chapter, we are going to see how everything comes together – that is, we’ll load a model from the controller and pass the model data to our view so that the end user will see data on the browser. We will also do the reverse, which is getting data from the user into our database, starting from the view and ending on the model. Furthermore, we will also learn the Rails way to perform ...
Get From PHP to Ruby on Rails 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.