Channels

Services

Rails 4.0 rolls out to reduce client-side coding

Focusing on a need to build modern web applications without having to create client-side JavaScript applications that talk to a server with JSON, the new version of Ruby on Rails, version 4.0, has arrived. To achieve this goal, the new release uses techniques such as Russian Doll caching to make caching much more efficient by maximising cache hits, Turbolinks that turn links into JavaScript-driven content reloading, and declarative ETags (entity-tags) so that servers can quickly determine if content is up to date. In combination, this should mean that sites which don't use the JavaScript/JSON route for performance should run much faster, especially under load.

David Heinemeier Hansson, creator of Rails, notes though that it is still "a great JSON server", but that the changes mean developers don't have to go down that route "just to have a super fast application". The new features were matured in the most recent version of Basecamp. Other Rails 4.0 innovations include live streaming over persistent connections, thread safety by default and no more need to configure for threaded servers, enhancements to ActiveRecord to improve the consistency of scoping and query structures, and locked-down security defaults.

A number of elements have also been removed from the core of Rails 4.0; Active Resource, Active Record Observers, and Action Pack page and action caching have all been moved into plugins. Change logs for ActionPack, ActiveModel, ActiveRecord, ActiveSupport and Rails itself cover the numerous changes, enhancements and bug fixes which make up Rails 4.0. In all, ten thousand commits and 500 contributors have worked on Rails 4.0 to produce what Heinemeier Hansson calls "an incredibly polished release" from a "bigger and more engaged community than ever before".

To switch to Rails 4, developers are advised to consult the upgrade guide or watch the Railscast screencast covering the new version. Rails 4 requires at least Ruby 1.9.3 and it is recommended that Ruby 2.0 is used. Ruby 2.0 will be mandatory for the future Rails 5 and beyond. Instructions for installing Rails are available on the Ruby on Rails site. Rails is published under an MIT licence.