Ruby on Rails MVC
To understand how Rails works you need to understand how the parts of Ruby on Rails fit together. The main parts are the Model, View and Controller.
The Model is where Ruby on Rails gets its data. It talks with the database by making an SQL Query. The model is where associations and validations are built. For example:
The View is what renders the DOM. More practically speaking, the View is the interface that users interact with. The following code in Views…
which renders the following on the user’s browser.
The Controller is the most important part of Ruby on Rails because it connects the Model and the Views. It also is where Ruby on Rails is converted to an API, which allows the developer to forego using Views and solely use Ruby on Rails as a backend. The Controller asks the Model for data which it can manipulate and then send to the Views.