Ruby on Rails MVC
Like most of the other frameworks, Rails is also based on MVC pattern. It basically works as following:
Requests first come to the controller, controller finds an appropriate view and interacts with model which in turn interacts with database and send response to controller. Then controller gives the output to the view based on the response.
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.
This subsystem is implemented in ActionView library. This library is an Embedded Ruby (Erb) based system which define presentation templates for data presentation.
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.
Next TopicRuby on rails rvm