Ruby on Rails: An Introduction
Ruby on Rails is also known as Rails in short. It is an open source application framework for the programming language, Ruby. In other words, Ruby on Rails runs on Ruby. While Ruby has been in the market for more than ten years now, Ruby on Rails is a relatively recent development.
Ruby on Rails gives web developers the ability to collect data from web servers, to request information from databases, and to render templates. Also, Ruby on Rails includes a routing system that works without the help of a web server.
History
It was David Heinemeier Hansson who created Ruby on Rails. He did so while working on Basecamp, a project management tool Hansson was working on while working at 37signals, a company that now specializes in web applications.
Rails was launched by Hansson in July 2004 as an open source framework. In February 2005, he shared his rights of Rails. In August 2006, Rails was announced to be shipped with Mac OS X v10.5 ‘Leopard’, by Apple, which was released in October 2007.
December 2008 was another landmark in Rail’s history. It was the time when the decision to add ‘the best ideas of Merb’ to Rails 3 was announced. Such development would eliminate all redundancies present in the communities of Rails and Merb. Hence, Merb was amalgamated into Ruby on Rails when Rails 3.0 was released.
March 2009 saw the release of Rails version 2.3. This version included new templates, nested model forms, Rack, and engines. The templates allowed developers to auto generate skeleton applications by using custom configurations. On the other hand, the web server interface, Rack, let developers write codes that could be routed around ActionController.
In August 2011, Rails 3.1 was released. This new version includes features such as asset pipeline and reversible database migrations.
A Few Advantages of Ruby on Rails
Users have found Ruby on Rails considerably different from other web application frameworks and object-oriented languages. They include the following:
- Rails prefers convention over configuration. For example, tables are multiples, default locations exist for MVCs, tests, languages, and plug-ins while the names of classes and files are in camel case and lower underscored case respectively.
- There is little redundancy. Everything is defined and stored in a single unambiguous location. Hence, it is very easy to find a code. The search can be ended as soon as the code is found. Also, Rails allows users to change codes with relative ease. Given these features, bugs related to inconsistency rarely occur.
- Everything in Rails is considered an object.
- Model View Controller – Model includes object relationships (including that of users and orders), controller includes business logic (such as the execution of a payment), while view includes visual representation (that is generated through HTML or XML).
- Codes can be reused. This saves developers a lot of time and effort. There are over 1300 plug-ins and gems that have been coded already and can be used by users of the open source versions of Ruby on Rails. Gits allow the merging and forking of codes easily while the website, Github, acts as a portfolio.
- Security – There are numerous features that help applications built using Rails secure themselves. Rails has the ability to protect its applications from SQL inject attacks and cross site scripting.
Ruby on Rails also suffers from a few disadvantages. Firstly, it can be considered inefficient by critics because:
- It uses a lot of memory. It can use up to 150MB per instance.
- It requires more application servers than other web application frameworks and object-oriented languages. Hence, while it may require less number of man hours, it requires more computing power.
- Lastly, Rails is hard to deploy as compared to PHP, but becomes easier when used with Passenger.
Technical Features
Ruby on Rails comes in different packages, depending upon the need of the users. Some of the packages include:
- ActiveRecord
- ActiveResource
- ActionPack
- ActiveSupport
- ActionMailer
Since Rails is of open source in nature, developers can alter it according to their needs by adding plug-ins in whichever package they are using. Ruby on Rails is essentially a web framework. Hence, like many others, Rails too uses the MVC architecture. It uses Model/View/Controller architecture to organize application programming. All in all, it is one of the best web application development tools available. No wonder, its use has been rapidly growing among large companies, some of which are mentioned below.
Examples of Rails Users
Some of the organizations that internally use Rails are:
- Hewlett Packard
- Intel
- NASA
While those that use it for external purposes include:
- Style.mtv.com
- Getsatisfaction.com
- Basecamp.com
- Yellowpages.com
- Twitter.com
- Yelloyello.nl
