Ruby on Rails (ROR) Tutorial

Ruby on Rails (ROR) Tutorial

Introduction

Ruby on Rails (RoR) is a web application development MVC framework built on Ruby language. It is open source and cross platform. MVC is the acronym for Model View Controller. It is a design pattern that separates the data (Model) from the presentation (View). The Models and Views are glued together using Controllers.

Ruby is an object oriented programming language. Since ruby on rails is built on ruby language, you can take full advantage of object oriented programming when working with ruby on rails.

Topics to be covered

We will cover the following topic in these tutorial series.

  • How MVC frameworks work
  • Features of Ruby on rails that make it superb
  • Prerequisites

How MVC frameworks work

The following diagram shows how the MVC architecture works

MVC Architecture

HERE,

  • 1 Web browser – visitors use web browsers to interact with the web server. The web server sends the HTTP requests to the server.
  • 2a Controller – the controller glues models and views together. The controller can also interact with the model if necessary to retrieve data.
  • 2b Models – the model is responsible for interacting with data sources i.e. databases, APIs, flat files etc. The model returns the retrieved data to the controller.
  • Controller – the controller is responsible for loading the view. The controller can also pass data from the model to the view.
  • Views – views are responsible for presentation, the HTML that is returned to the browser.

Features of Ruby on rails that make it superb

Ruby on rails is an MVC framework so advantages inherit to the MVC architecture also apply to ruby. We will not list such advantages in this section. Below are some of the features that are more specific to ruby on rails.

  • Convention over configuration – conventions are like agreed upon ways of doing things. For example, a database table name is expected to be plural, it is also expected to have an auto generated primary key named id etc. Ruby on rails calls these sensible defaults. If you follow this conversion, then you don’t need to configure a table name or specify an auto increment column named id for your tables. It is recommend to follow conversions over configuration. Should you have good reason not to use sensible defaults, you can still configure ruby on rails
  • Rapid Application Development – convention over configuration leads to writing less code and speeds up application development.
  • Short learning curve due to simple and easy to read syntax – Ruby in rails has a very simple syntax. You don’t have to end all statements with semi colons like in most languages that were derived from
  • Ruby on rails is built on don’t repeat yourself (DRY) principle. Naturally, it encourages you to write DRY code

Prerequisites

The following are the pre-requisites for learning ruby on rails

  1. HTML, CSS, JavaScript – This is the language of the web. It is not necessary to know HTML to write ruby on rails applications but if you are developing an application for humans then knowing the basics of HTML will do you justice. CSS and JavaScript spices up the web. It’s an added advantage and not a must know
  2. Web browser – you will need to execute your code as you develop and see the output.
  3. Web server – the web server is responsible for handling HTTP requests and returning the responses.
  4. SQL – SQL is the acronym for Structured Query Language. It is used to query databases. Ruby on rails’ ActiveRecord actually writes the SQL statements for you but it’s an advantage when you know what is going on behind the scenes.
  5. Programming basics – this is not mandatory but if you are familiar with programming principles then it will be easier for you to learn ruby on rails
  6. Ruby language – this is an added advantage.

Summary

Ruby on rails is a powerful MVC framework that speeds up developing web applications. It has a short learning curve and it’s an open source framework. Ruby on rails is a powerful

What’s next?

These tutorial series are designed to teach you how to program using ruby on rails from scratch and transform you into a professional ruby on rails developer.

If you found this tutorial useful, support us by using the social media buttons to like and share the tutorial. If you didn’t find it useful, please use the comments section below to let us know how we can do better next time.

Each week, a new Ruby on Rails tutorial is added to our collection. Subscribe to our newsletter, like our Facebook fan page or follow us on Twitter to get free updates when the collection is updated.

Tutorial History

Tutorial version 1: Date Published 2015-09-21

Our Curriculum

this tutorial shows you how to install and configure ruby on rails, and briefly discusses the key software components for ruby on rails....readmore

this tutorial shows you how to create and configure a new ruby on rails project and create a basic hello world web app....readmore

This tutorial introduces you to working with databases in ruby on rail using a practical step by step rails database example....readmore

This tutorial introduces you to basic rake commands that you need to know and how to create your own custom rake commands....readmore

Related Tutorials