Third generation of Rails–Rails 3

By Thomaskutty Sebastain on December 17, 2010

Rails 1.0 brought us a revolutionary way to think about web development.
Rails 2.0 brought us a cleaner, stable day-to-day API for building applications in Rails.
And
Rails 3.0 bring us speed, extensibility, and a richer ecosystem.

Ruby on Rails
The Ruby on Rails is a framework designed for quickly and cleanly writing web application. Ruby on Rails often shortened to Rails or RoR. Rails application are developed using the Model View Controller (MVC) pattern. It is intended to be used with an agile development methodology that is used by web developers for rapid development.
Rails debuted in late 2004 and changed the way a lot of people think about web development.

Rails 3 gets Supersized with Merb
Ruby on Rails and Merb are MVC web application frameworks written in and for Ruby. Both have similar directory structures and concepts. Rails are focused on rapid development for the web programmers. Merb is focused on speed and extensibility.

rail1

Merb is ORM-agnostic, JavaScript library agnostic, and template language agnostic, preferring plugins that add in support for a particular feature rather than trying to produce a monolithic library with everything in the core.
Rails are now more modular and faster after merging with rival Merb. Ideas from the Merb framework have been incorporated into the popular web framework Rails, resulting in speed and performance improvement.

Architectural Changes
1. Railties Restrung
Railties was updated to provide a consistent plugins API for the entire Rails framework allowing developers to hook into any stage of the generators and application framework in a structured manner.
2. All Rails core components are decoupled
All Rails core components are now using the same API that you can use for developing plugins. Now customized plugins and core component’s can access all the Rails core components accessible functionalities thereby allowing it to extend and enhance it.
3. Active Model Abstraction
Decoupling process has separated all ties to Active Record from Action Pack. New ORM plugins will seamlessly work with Action Pack by implementing Active Model interfaces.
4. Controller Abstraction
AbstractController has been introduced. Now ActionController and ActionMailer has been refined by removing common code from all these libraries and put into Abstract Controller.
5. Arel Integration
Arel is a Relational Algebra for Ruby. It simplifies the generation complex of SQL queries and adapts to various RDBMS systems. Arel provides an SQL abstraction layer that simplifies Active Record and provides the underpinnings for the relation functionality in Active Record.
6. Mail Extraction
Email message related functionality abstracted out to the Mail gem. It reduced code duplication and helps to create definable boundaries between Action Mailer and the email parser.

Dependency Management with Bundlers
Rails 3 introduces Bundler, a very simple way of managing the dependencies of your application. Rails application typically depends on a number of Ruby gems (what Ruby calls its libraries). Up until Rails 2.1, you basically had to manage any of your application’s dependencies yourself. Rails 2.1 (and 2.2) introduced some dependency management in the form of gem.config, but its usage was little difficult to undersant.

Rails 3’s Bundler makes gem management as simple as you can imagine. You put a file in your application’s root, called Gemfile, where you specify which gems your application needs.
Once you have set up the Gemfile to your satisfaction, all your need to do is run this command from your application’s directory:
bundle install
Bundler will then download all the required gems (and any dependencies they might have) to your machine.

Unobtrusive JavaScript
It’s a general approach to the use of JavaScript in webpage’s. Rails 3 replaces inline JavaScript with HTML5 attributes. Action View helpers has been refined by implementing Unobtrusive JavaScript (UJS) hooks and removing the old inline AJAX commands.
JavaScript framework can be selected based on our choice and it allows easy integration.

Internationalization
Now i18n latest gem can be used with rails applications this will enable more control over the Internationalization implementation.
Easy integration – By including ActiveModel::Translation and ActiveModel::Validations it’s easy to add I18n behavior to any object.
Default attributes – Default attributes across different models and ORMs can be specified now.
Form Submit Tag – Forms submit tag can now be called without arguments, this will allow customized labels with I18n.

Security Improvisation
Cross-site scripting (XSS) protection is now enabled by default. The h method would escape html and JavaScript to ensure that no malicious client-side code was executed, now it is enabled by default.
Raw method can be used to allow unescaped data.

Only few features of Rails 3 have been covered. Thanks for reading.

Leave a Reply

SCROLL TO TOP