![]() |
VOOZH | about |
Ruby on Rails, also called Rails, is a web framework for server-side web applications that is implemented in Ruby. It was developed by David Heinemeier Hansson and launched in 2004. The philosophy is that application development should be easy, and it does so by making a set of guesses as to what every developer will need. It enables the evolution of applications within short periods of time according to conventions (CoC) or the well known principle of Don’t Repeat Yourself (DRY) to ensure clean source code.
Table of Content
Ruby on Rails is designed to handle several key tasks that are essential for web development:
Rails implements the MVC (Model-View-Controller) architecture, which divides applications into three parts: Model, View, and Controller, organizing the application in a natural way. Use of MVC pattern is crucial if at all one is to come up with quality web applications that can easily be maintained.
The Model corresponds to the data of the application.In Rails, models are Ruby classes that represent the data and contain the business logic of the application. In Rails, the Active Record library provides the model the capability to interact with the database and to fetch or store data.
The View is responsible for displaying the data provided by the Model in a format suitable for the user. It translates the data that the model present or generate into a format that the users can comprehend. Pages are normally HTML pages that contain Ruby code written in the Embedded Ruby (ERB).
The Controller processes user inputs, interacts with the Model to update or retrieve data, and renders the appropriate View to display the results. It works between the model and the view and handles user’s request, retrieves information from the model and displays the correct view.
Here’s a pictorial representation of the MVC framework in Ruby on Rails:
The directory structure in a Rails application is in support of the MVC pattern. Below is a brief overview of the key directories:
Ruby on Rails is a full stack web framework that has been designed with the MVC framework pattern and is very friendly to developers to enable them to come up with elegant and maintainable applications. Being based on best practices it is full of in-built tools and libraries to make coding easy for both newbies and advanced coders. It can be used for a simple application or for complex application, with Rails you have everything that you need to ensure that your ideas work effectively.