Ruby on Rails 3.1 and Sprockets – A closer look

Ruby on Rails 3.1 uses a new technology called Sprockets to speed JavaScript execution. Sprockets compiles all the features that a Web application uses into a single file, that simplifies work for the developer and quickens the response time of the application. New features to look out for-

Asset Pipeline

Asset Pipeline is the principal feature of the release (Ruby on Rails 3.1) . In simple terms it allows proper organization of CSS and JavaScript files. The asset pipeline helps to make it simple to organize and serve your assets.

Combining the pipeline with a well-tuned web and application server means that web sites being blazing fast! Also, browsers will load pages quicker than ever before, specially when used with the asset pipeline, because it’s just one file used throughout the app. Ideally, while the user is navigating through your website, his browser wouldn’t need to load the assets again since it’s cached; so loading time is only experienced at the first visit.

HTTP Streaming

HTTP streaming(Ruby on Rails 3.1 update) helps the server by sending data to the client in chunks. Rather then sending it only when the page has been fully rendered, it sends rendered content as soon as it’s produced.

jQuery is now default

The default JavaScript library for Ruby on Rails has been switched to jQuery. Users can easily change from the previous default library, Prototype, through a single command. Developers shouldn’t notice any difference, and going forward, Ruby on Rails will be able to harness the work being done on this popular library.

These are just some of the new features available to you with Rails 3.1. There’s a lot of other good stuff you can explore. Tell us which of the features listed here would most suite your needs. Happy coding!