Acquaintance with Ruby on Rails.

Beksultan Kaiypov
4 min readDec 7, 2020

In this blog I will cover the following things:

  • A brief history of Rails
  • The benefits of using Rails
  • MVC (Model View Controller)

History of Ruby on Rails

Rails (RoR) is a framework for developing dynamic web applications.

It was created in 2004–2005 by David Hansson (who is also a racing driver).

It was back in 2003 when Ruby on Rails came into existence. When David discovered this web application platform, he was working on the code base for a project management tool known as Basecamp. While it took David until July 2004 to formally release it as an open source code, the subsequent popularity it received was not affected. Even though David launched his framework in 2004, it was not until 2005 that he shared its commit rights. Later that same year, David released version number one of Ruby on Rails, with the initial versions based on the Mongrel web server.

Who is using Rails?

One of the most popular programming languages and frameworks in the world today is Ruby on Rails. Millions of people use it to build some awesome websites every day, and as a result, jobs at Ruby on Rails are also becoming more and more prevalent.

So who is using Rails? Lots of large as well as medium sites like Hulu, Groupon, LivingSocial, Twitter, Airbnb and Github.

Startups in general love Rails because of its ability to quickly prototype and develop applications quickly.

Why Rails?

One of the principles of using Rails is called Convention Over Configuration.

You could approach application development in one of two ways. In one of them, you set up everything you do from scratch.

Or, you can rely on conventions that have already been established. In my opinion, the best practice is to use already existing conventions.

And if you follow certain conventions, you will write less code — sometimes the framework generates it for you.

Another advantage of this pattern is that you learn project development once, and you can apply the same concepts to your next Rails project. So, you will know what to expect next time.

The next advantage of Rails is that you have a database abstraction layer. Ruby on Rails allows you to interact with the database not by writing SQL queries, but interact with the database by writing Ruby code.

It is referred to as ORM, or Object Relational Mapping. You are mapping your database to your Ruby classes.

Also, Rails:

  • Favorable for agile development
  • Follows the principle of DRY (Don’t repeat yourself)
  • Open source
  • Modular

SQLite

Another interesting feature of Rails is that it uses SQLite as its default database.

SQLite is an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. The code for SQLite is in the public domain and is thus free for use for any purpose, commercial or private.

Which basically means it’s just a file lying on your filesystem, but it acts like a relational database.

The advantage of this is that you don’t have to set up a complex database engine to start developing your application.

When you create a Rails application, the ability to interact with the database is right in the “box”.

Since the database is abstract here, you can switch to another DBMS later if you want. But in the beginning, you don’t need to go through these setup details.

In addition, SQLite is the most widely used SQL database in the world. It is used by browsers, iPhone, Android, and many large applications. Because, again, it behaves like a relational database, but in reality it is just a file.

MVC: Module, View, Controller

Another concept that Rails uses is the idea behind the Model View Controller.

MVC was invented by Norwegian professor Trygve Reenskaug in 1979.

It is a well-established programming pattern used by many web and desktop frameworks.

Model — represents the data that the application works with.

View — is a visual representation of this data.

Controller — Coordinates the interaction between the model and the view.

MVC cycle

  1. Request sent from the browser
  2. Controller ← → Model
  3. Controller launches View
  4. View displays data

Eventually, Rails is very well suited for rapid prototyping.

Using patterns and conventions allows you to think less and do more, thus increasing developer productivity.

If you want to try and build a Ruby on Rails application, here’s very helpful and detailed guide.

GOOD LUCK!

--

--