Blogs

Forum

Guide

Useful Links

Meta

Subscribe

C. Intermediate::Rails

What is Rails ? its Installation,

Rails is an open-source web application framework written in Ruby that closely follows the Model-View-Controller ( M-V-C ) architecture, it is also called as Ruby on Rails(RoR). It is for developing database web applications. It strives for simplicity and allowing real-world applications to be developed in less code than other frameworks and with a minimum of configuration.

It uses two important concepts : CoC and DRY.

CoC stands for “Convention over Configuratio”. Convention over Configuration” means a developer only needs to specify unconventional aspects of the application. For example, if there’s a class Sale in the model, the corresponding table in the database is called sales by default.

DRY stands for “Don’t Repeat Youeself”, means every piece of information should be placed at one place only.

Rails design follows M-V-C architecture,

Model: The model is responsible for maintaining the state of the application. Sometimes this state is transient, lasting for just a couple of interactions with the user. Sometimes the state is permanent and will be stored outside the application, often in a database. A model is more than just data; it enforces all the business rules that apply to that data. and make sure that nothing else in the application can make our data invalid.

View: The view is responsible for generating a user interface, normally based on data in the model. Although the view may present the user with various ways of inputting data, the view itself never handles incoming data. The view’s work is done once the data is displayed. There may be many views that access the same model data, often for different purposes.

Controller: Controllers handles web request from user, receives requests from the outside world (normally user input), interact with the model, and display an appropriate view to the user.

Rails Installation

Ruby must be installed for rails installation.

Check for gem installation by typing gem –version in a command window.