The Complete Picture


Collapse Content

Here's a full look at Ruby on Rails as a physical machine. This machine lets customers view the inventory of a store, but it could easily be adapted for other purposes such as a 1915 version of Twitter.

The customers enter their requests by sending an “HTTP” card to the Router. The Router which sends the parameters from the card to the appropriate controller and action. For example, if a user asked to views product #11, the router will pass "43" to the Product Controller’s viewing action.

The Controller contains configurations to get the relevant data from the Model. In this case, it asks the model to find Product #11, and the Model uses SQL behind the scenes to get that product from the database. This product data is returned to the controller, which makes it the @product available to the View.

The View automatically inserts the actual @product data into the correct template and inserts the template into a general layout. This complete page is then returned to the the user who made the original request.

You can also view an animation of this process below:

Contact Us