Ruby on Rails featuring the MVC

Jorge Najera
3 min readMay 29, 2021

Rails has been a solid tool for development for the past couple of years that still is evolving thanks to their committed community. One of the principal points I found when starting developing on Ruby on Rails in my early days of developer was the clear structure folder for getting the MVC (Model, View and Controller) in place that just feels right from the start.

A fun way to represent the MVC on the real world it will be thinking on how an MUSICAL ORGANIZATION works, it directed by the Orchestrator (Controller), it has several Musicians (Models) and the result will be a marvelous piece of MUSIC (Views).


It’s important to understand what are the responsibilities of each piece on the MVC. Presentation goes in the view, business logic goes in the model and the controller glues them together is the basic logic of the MCV.

MODEL — Business Logic / Musicians

Inside Rails we find that the model will have a relation with the Database thought ActiveRecord, so each model can represent a dataset from a database table. ActiveRecord give superpowers to our model class, so it can retrieve, save, edit, and delete data from the database, also give the ability to create validations and associations for creating a more robust business logic inside our APP.

We need Musicians to get the music going, and it’s composed by a complex set of trumpeths, violons, battery, saxophones, arps, etc. As in Rails we depend on several models that can hold a specific business logic and play the key role to construct our business logic.

VIEW — Presentation / The Music

The view is the data representation of our request that came from our browser, like HTML, JS, JSON, PDF, or whatever content is supposed to deliver back following the request instructions. In Rails is represented by ActionView the component that create those representations of data.

In other words the VIEW is the only thing that our users can see this through the User Interface that we build for our APP. So in the Orquestra will be represented all the pieces working together as one to generate a piece of Music.

CONTROLLER — Superglue / Orchestrator

Our superglue is the Controller the one that handle the request and facilities the communication between the model and the view, and inside Rails this is represented by ActionController.

We can say that the Controller it’s the orchestrator of our melody, it will tell how to act to each individual piece to take the actions to create the response to the request we will return.

How I image the controller on the daily basis


In conclusion, the MVC give us the ability to divide layers of information or have make each piece accountable to work on their job. If we follow the good practices of the MVC it will help to make our applications more scalable, fun to work with and maintainable, that is the main goal.

This video Has Been Brought to You By the MVC



Jorge Najera

Cofounder at Bolteam & Actiun. Fullstack Engineer, Coffee junkie and Crazycatman.