<

Ruby on Rails MVC


Rails has an application directory called app/ with three subdirectories: models, views, and controllers. This is the model-view-controller (MVC) architectural pattern, which enforces a separation between business logic from the input and presentation logic associated with a graphical user interface (GUI).

Model



The models are classes in Rails. They interact with database, store data, handles validation, transaction, etc.
This subsystem is implemented in ActiveRecord library. This library provides an interface between database tables and Ruby program code that manipulates database records.
Ruby method names are automatically generated from database tables field names.

View



View represent data in a particular format in an application for the users. It handles HTML, CSS, JavaScript and XML in an application. They do what controller tells them.
This subsystem is implemented in ActionView library. This library is an Embedded Ruby (Erb) based system which define presentation templates for data presentation.

Controller



Controller directs traffic to views and models. It query models for data from the database and display the desired result with the help of view in an application.
This subsystem is implemented in ActionController library. This library is a data broker sitting between ActiveRecord and ActionView.















© copyright 2017-2022 Completedone pvt ltd.