Ruby on Rails Tutorial

Introduction to Ruby on Rails

Ruby on rails, or Rails is an MIT- licensed, full stack server-side web application framework written in Ruby language by David Heine Meier Hanson. This is an extremely productive framework uses MVC (Model-View-Controller) pattern to organize application programming.

Framework is a set of programs or a code library that provides a reusable software environment and a standard way to build and deploy applications.


Ruby is a dynamic, open-source, fully object-oriented scripting programming language, and a successful combination of Smalltalk’s conceptual elegance, Perl’s pragmatism, and Python’s ease of use and learning. It runs on a variety of platforms like Windows, Mac OS, and all versions of UNIX.

In the mid-1990s, Yukihiro "Martz" Matsumoto designed and developed Ruby (chose this name as one of his colleagues' birthstone) in Japan.

Ruby focus on simplicity and productivity. It has elegant and concise syntax, i.e., easy to read and write. It is fully object-oriented such that everything exists as an object; each and every code has its properties and actions where properties refer to variables and actions refer to methods. It considered following the principle of least astonishment (POLA) in which language acts in such a way to minimize the experienced users' confusion. 

Ruby enriched with the following features as below:

  • Easy to learn
  • Open-source
  • Rich libraries
  • Truly and fully object-oriented
  • Easily extensible
  • Less coding with fewer bugs
  • Helpful community
  • Dynamic type system
  • Automatic memory management

Ruby Versions

Many Ruby versions have released till date. Current stable Ruby version is 2.4


Release Date


August 4, 2003


December 25, 2007


February 24, 2013


December 25, 2013


December 25, 2014


December 25, 2015


December 25, 2016


Future release


Rails is an open-source, server-side/back-end, web-application development platform designed and developed by David Heinemeier Hanson in Ruby programming language. It is a web development framework that creates web applications by combining Ruby programming language with HTML, CSS, and JavaScript. It provides ten times faster web-app development in comparison with a typical Java framework.

Rails is a full stack framework

  • That allows us to write fewer lines of code than other frameworks.
  • Saves time and efforts ensuring high-quality web-apps.
  • In which all the layers are built as indefectible to work together with less code.
  • That fulfills every requirement for database-driven web-app development by using MVC pattern.

Model View Controller (MVC) is an architectural pattern established as a general concept in The Journal of Object Technology in 1988, it is commonly used for creating UI (User Interfaces). It divides an application into three parts:

  • Model is the application’s dynamic data structure that consists code to work upon application data specifying data retrieving, creating, updating, and deleting.
  • View represents information in a particular format like bar charts, tables, or diagrams and enables users’ interaction with the application by working as a visual layer.
  • Controller controls both the model and the view in such a way it accepts input from the user, converts it to commands, works with models to process it and finally instructs the view to display output to the user correctly.

Principles of Rails

Three major design principles characterize the Rails way of doing development above anything else:

  1. Active Record Pattern is the architectural design pattern of data that represents models with their data, inter-model association, validates models, stores object data in relational database, performs database operations, and alongside automatically creates ways for the application to read and modify data stored in a database with an acronym mentioned as “CRUD” that stands for Create, Read, Update, and Delete.
  2. Don’t Repeat Yourself (DRY) principle aims to reduce code repetition within a complex system as much as possible such that any modification in the development cycle can be quickly done and every single information should have a clear and relevant link to the rest of the system.
  1. Convention over Configuration principle aims to reduce developers’ time and effort such that they don’t need to spend a lot of time for configuring files to get set up. Rails provides a set of conventions for speed up development.

Versions of Ruby on Rails


Release Date


December 13, 2005


January 19, 2007


December 7, 2007


June 1, 2008


November 21, 2008


March 16, 2008


August 29, 2010


August 31, 2011


January 20, 2012


June 25, 2013


April 8, 2014


August 20, 2014


December 18, 2015

Features of Ruby on Rails

These are some features of Ruby on Rails are as follows:

  • MVC architecture

Ruby on Rails is MVC (Model View Controller) based architecture that enables you to separate data from presentation.

  • Database Access Library

There exists Database access library (Active Record) that simplifies data handling in databases and automatically maps tables to classes and rows to objects.

  • Libraries for common tasks

Ruby on Rails provides a host of libraries by which you can simplify the coding of common programming tasks such as form validations, sessions management, etc.

  • AJAX Library

Rails framework provides an extensive AJAX functions library. The associated java scripting required for AJAX gets generated automatically.

  • Convention over configuration

Ruby on Rails reduces developer’s time and effort such that they don't need to spend a lot of time for configuring files to get set up. Rails provides a set of conventions to specify the configuration parameters for speed up development.

  • Customized URL

Custom or Search Engine Friendly URLs can be developed using the Ruby on Rails framework.

  • Debugging

It is easier to debug applications by using the existing detailed error logs.

  • Component

Components can be used to store reusable code and can be included to modularize templates.

  • Rails API

Rails API allows you to generate API and cleans all the unnecessary middleware for an application.

  • Customized URL

Search engine friendly URLs can be created in Rails.

RoR based Web-Apps

These are the following most famous web applications written in RoR:

  • GitHub is the most popular platform launched in 2008 for code developers to host IT-Projects and to facilitate developer’s collaboration. It is free of cost for the open-source software projects and offers paid repositories for private projects. Now Github is considered as the most significant code repository in the world that boasts around 22 million users and 61million repositories across the globe.
  • Airbnb is popular for the traveler that offers vacation rentals at more than 65K locations in 191 countries all over the world. This web app is designed to provide comfortable apartments, rooms, treehouses and boats instead of hotels such that you can save money for accommodation.
  • Basecamp is the web application designed for project management and collaboration tool that helps to manage a project with features including delegating tasks, monitoring progress, organizing project members, managing documents, and scheduling.
  • Kickstarter is the world’s largest crowd funding platform launched in 2009 for creative projects and became the initial point for famous projects like Petcube. Using this app, the global community together can present the ideas and can fund or invest in creative projects. The Veronica Mars Movie Project and Oculus Rift are the other such famous projects.
  • SlideShare is RoR based web app popular in web conferencing and education sectors designed to host slideshows and presentations, enables to upload and share presentations in various formats such as OpenOffice, PDF or Powerpoint. It was launched in 2006 and became the part of Linkedin in 2012. At now, the weight of uploaded content exceeded 18M pieces.

PROS and CONS of Ruby on Rails

These are the following benefits and pitfalls of Ruby on Rails:


  • RoR provides a great number of helpful tools and libraries you can use as a part of your software which influence software design experience, helps in debugging, and also in optimization.
  • RoR is easy to learn and helps in faster and effective web app development providing hundreds of tools that accelerates and simplify overall coding experience, sparing your time form time-consuming tasks.
  • RoR has a large community of dedicated developers to fix any bug of application at an instance.
  • RoR is cost effective. It provides the functionality to building process having a collection of open source code as well as a set of existing conventions.
  • RoR is highly flexible and efficiently interacts with technologies and frameworks by which developers can separate layers of the app and can use multiple techniques.


  • RoR is difficult to learn and not popular as compared to PHP and Java instead of having a large number of developers.
  • RoR based web apps are not as fast as compared to Java and C apps.
  • A small mistake or a wrong judgment at the beginning of development can slow down entire application significantly, can disrupt different connection parts of your software and lead to unintended consequences.