BT

Ruby on Rails 3.1 Released, Brings Assets Pipeline, Streaming, and Javascript Changes

by Mirko Stocker on Sep 03, 2011 |

A few days ago, the Ruby on Rails team released version 3.1 of the most popular web framework for Ruby, almost exactly one year after their last major release of Rails 3.0. These are the highlights of the release: 

  • Assets Pipeline
  • Streaming
  • Reversible Migrations
  • jQuery as the default JavaScript library

The assets pipeline is the major change in Rails, and there's a complete guide that describes how it can be used and what it does: 

The asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets. It also adds the ability to write these assets in other languages such as CoffeeScript, Sass and ERB.

The assets pipeline was also the topic of David Heinemeier Hansson's RailsConf talk.

Streaming means that Rails now supports HTTP streaming, which is also known as chunked transfer encoding. The advantage of streaming is that the web server can start transmitting the response before it has been fully computed. The Rails team explains the benefits of streaming in their blog

Streaming doesn't cut latency, neither it cuts the time a dynamic response needs to be generated. But since the application sends content right away instead of waiting for the whole response to be rendered, the client is able to request assets sooner. In particular, if you flush the head of an HTML document CSS and JavaScript files are going to be fetched in parallel, while the server works on generating content. The consequence is that pages load faster.

There's also a Railscast that explains how to set up streaming for a Rails application.

Rails has supported down migrations for a long time, so why are reversible migrations new? Until now, you always had to write the down-migration yourself, but Rails 3.1 can now do this for you. Rohit Arondekar explains how the magic works

Basically if you define a change method [instead of up and down methods as before] in your migration and are applying the migration then the commands are executed as normal. However while reversing the migration, the commands are recorded and a list of inverse commands is generated and run. Inverse commands are simply commands that perform the opposite of the original command.

These are only some of the changes in Rails 3.1, there are dozens more in the detailed release notes for you to discover. For example, a configuration option to force SSL has been introduced. To see if your plugins are already working with 3.1, check out and contribute to railsplugins.org.

Do you plan to upgrade your applications? Austin Hughey has some advice in his article on The H.

Hello stranger!

You need to Register an InfoQ account or to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Hyped in 2006.. by Rubén Parés-Selders

..and you might think now hey, is that thing really alive? We're using rails & jruby in an old school java env and I can just tell you: It's smoking hot. The community is: Vibrant. The documentation is: Awesome. So, if you haven't: Give it a try.

Just my 2 cents for Monday.

Re: Hyped in 2006.. by Richard Clayton

I scoffed at the Ruby crowd, but after an someone recently recommended Ruby and Rails, I decided to give it a try. After only two months of using Ruby, I've decided that I'm done with C# and Java.

I agree with Ruben; just try it. If you don't know where to start, do the Try Ruby tutorial. When you are done, I recommend reading Russ Olsen's "Eloquent Ruby" book (Addison-Wesley). Learning basic Ruby is not going to do it for an experienced programmer. To really understand the power of the language, you have to quickly transcend the basic syntax.

Once you've got a handle on Ruby the language, play with Rails, RSpec, and ActiveRecord. After a week with those frameworks, you'll dread doing anything else in another language.

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

2 Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2013 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT