What Is Ruby on Rails?

Ruby on Rails is a framework with which dynamic websites based on content stored in databases can be developed in short time. The framework encapsulates access to the database and request processing. Thus, it saves a large amount of time required for developing the corresponding code in other environments.

In Ruby on Rails projects the functions offered by portals, for example, are considered more important than in classic projects focused on static content. This makes Ruby on Rails the ideal tool for Web 2.0 applications and their community functions such as blogs, rating, commenting, etc.

A Ruby on Rails runtime environment is a closed system composed of the Ruby interpreter and numerous scripts, helper programs and libraries. A Rails application consists of a directory tree containing the configuration, the views, the controllers, the database model, and other things.

Due to the Model-View-Controller architecture, i.e. the clear distinction between the data, its processing, and its display, the web applications are easy to maintain. In the following, the terms used in this architecture are briefly explained.

Model

The data model, i.e. the structure of the data and its interrelations, are mapped in Ruby on Rails to classes, methods and properties. A class normally corresponds to a database table, a row in it to an object, and an object's properties to fields. Due to this object-relational mapping of data to the object-oriented model of the programming language, the handling of data is consistent with the handling of the built-in and programmed classes and objects.

View

A view is what you use to make your data visible. Typically, a view contains HTML text, into which Ruby code is embedded by means of processing instructions, analogously to PHP, for example. The contents of a shopping cart could be a view, a particular website section as well.

Controller

A controller is a Ruby file that is executed if a request whose URL contains a particular component is to be handled. If, for example, a customer opens his shopping cart on a website, the controller recognizes this by identifying the corresponding URL component (cart, for example), fetches the associated data from the database and prepares it for the view. Then, the view associated with this controller is processed and the HTML page generated in this process is delivered.