Ruby on Rails

Ruby on Rails

Ruby on Rails

Ruby on Rails is a free framework that promises to increase speed and ease in website development-oriented database (database-driven web sites), since it is possible to create applications based on predefined structures. Often referred to as Rails or RoR, Ruby on Rails is an open source project written in Ruby programming language. Applications created using the Rails framework are developed based on the design pattern MVC (Model-View-Controller).

Ruby on Rails was extracted from a David Heinemeier Hansson of one of its projects, the project manager Basecamp. It was released to the public for the first time in July 2004.

Ruby on Rails Components

Rails is a “meta-framework”, since it is a junction of five frameworks:

Active Record

Active Record is a layer of mapping object-relational (object-relational mapping layer), responsible for interoperability between application and database and data abstraction.

Action Pack

Understands the Action View (generation of user viewing as HTML, XML, JavaScript, etc.) and the Action Controller (control the flow of business).

Action Mailer

The Action Mailer is a framework responsible for the delivery service and even receive e-mails. It is relatively small and simple, but powerful and able to perform various operations with calls only mail delivery.

Active Support

Active Support is a collection of several useful classes and extensions to standard libraries, which were considered useful for applications in Ruby on Rails.

Action WebServices

Provides a way to publish interoperable APIs with Rails without the need to spend time in protocol specifications. Implements WSDL and SOAP.

The Action Web Service is no longer present in version 2.0 on Rails, since that is turning to the use of the REST model. Still, even those interested in using it, you can do so by installing a plugin.

Development Time

Ruby on Rails follows two concepts aimed at increasing developer productivity: DRY and Convention over Configuration. These methods are implemented across the rails, but may be more noticeable in “packages” Active Record (ORM, Object Relational Mapper) and Action Pack (MVC)


DRY (Do not Repeat Yourself, Do not repeat yourself) is the concept behind the technique of defining names, properties and codes in one place and reuse this information to others.

For example, instead of having a People table and a class Person with a property, a method “accessor (getter) and a” modifier “(setter) for each field in the table, it has been only in the database. Properties and methods needed are “injected” in the class through features of Ruby.

Thus, this saves time, since it is not necessary to change the table, the “bean”, the “form bean”, the “home site”, the “home”, the “session”, … Changing only the database, everything is based on this information is updated automatically.

Convention over configuration

In most cases, we use conventions in the day-to-day programming in general to facilitate understanding and maintenance by other developers. Knowing this, and knowing that the time spent to set up frameworks for XML in some other languages is extremely high, it was decided to adopt the concept.

He basically says that one must assume default values where there is a convention. If the developer wants, you can override this convention with the necessary amount. For example, a User class can have their data stored in the Customer table. Following convention, would be in the Users table. Thus, the development time drops further.

Ruby on Rails – Scalability

Most sites do not need sophisticated schemes to scale, just a few accelerators. In smaller sites, or normal, a default web server can handle a good amount of cargo, especially if you use FastCGI, Mongrel or LightTPD, which are necessary to obtain an acceptable speed of opening the page. Comparing an application with FastCGI and FastCGI without (running straight as Ruby CGI), the difference is noticeable in any application. The processing of the code (not counting download time) CGI occurs in at least 10 seconds even on servers Quad Core, while in FastCGI performance is remarkable: in a maximum of 1 second page is processed, such as which web languages PHP.

There are cases of websites done in Rails that supported 5 million hits a month, or approximately 115 per minute, a performance considered sufficient for 90% of current applications. In these sites, a frequent question is about the scalability of applications written in Rails. Unlike other technologies, you do not need a specific code that the system is prepared to “escalate”. When necessary we can adopt one of the tactics available to scale on Rails. Notably, the only problem of scalability is to maintain sessions between servers. Therefore, the output most obvious is to keep these sessions on NFS volumes, accessible by all application servers. Another tactic is to use session caching directly to the database. A third would save the session in a cookie on the user’s machine. As you can see, a Rails application is born with all the support necessary to grow painlessly.

Study: From Wikipedia, the free encyclopedia. The text is available under the Creative Commons.


Leave your comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.