Ruby on Rails is a framework for the Ruby language, which is used for rapid development of web applications. It does this by allowing you to concentrate on solving your clients problems and not getting caught up in building an infrastructure to support your clients problem. Let’s face it, you don’t want to build database access layer every time you start a new project. Neither will you want to implement a fully functioning MVC pattern on a regular basis. This is the whole point of frameworks; they give you a starting point from which you can build upon.
Little more about MVC
It’s worth mentioning MVC (Model View Controller) because it can be one of the factors that discourages people from trying frameworks like Rails. It is rather an advanced way of programming most famous architectural style.
Lets see them in brief
Model – The model layer is where you define classes for the data your application will use/store. For instance, if you want to store posts for a blog, you will have a “Post” model. The model has the capability to interact with the database, to retrieve and store data. This functionality is gained by inheriting it from the Active Record super class. Any methods, which act upon this data, should also be placed in the model.
View – The view layer has one main purpose to return the relevant HTML to be rendered on the users browser. In Rail a view is held in an erb (Embedded Ruby) file, which contains both HTML and embedded Ruby statements.
Controller – Without the controller, nothing would happen. The controller interacts with the model to retrieve and store data. It will then pass any data, acquired from the model, to the view. The view returns the resulting HTML to the controller and the controller sends this back to the users browser.
Read more – Create a Blog Using Ruby on Rails
Little more about MVC
It’s worth mentioning MVC (Model View Controller) because it can be one of the factors that discourages people from trying frameworks like Rails. It is rather an advanced way of programming most famous architectural style.
Lets see them in brief
Model – The model layer is where you define classes for the data your application will use/store. For instance, if you want to store posts for a blog, you will have a “Post” model. The model has the capability to interact with the database, to retrieve and store data. This functionality is gained by inheriting it from the Active Record super class. Any methods, which act upon this data, should also be placed in the model.
View – The view layer has one main purpose to return the relevant HTML to be rendered on the users browser. In Rail a view is held in an erb (Embedded Ruby) file, which contains both HTML and embedded Ruby statements.
Controller – Without the controller, nothing would happen. The controller interacts with the model to retrieve and store data. It will then pass any data, acquired from the model, to the view. The view returns the resulting HTML to the controller and the controller sends this back to the users browser.
Read more – Create a Blog Using Ruby on Rails