Tuesday, March 22nd, 2005

Ruby on Rails 0.11 includes native Ajax support

Category: Ajax, Ruby, Screencast

Rails 0.11.0 is out on the street and I’m especially proud of the Ajax support we’ve been able to include. Instead of trying to soften the blow of doing client-side Javascript libraries as many others are doing, we’ve gone ahead and more or less removed the need for hand-written client-side javascript entirely.

This is done by off-loading the creation of DOM elements to the server side, which returns complete constructs that are then injected live through innerHTML. While this method is slightly more verbose than just peddling data across the wire, it’s immensely easier to develop.

And especially the ease of development is critical to the success of Ajax. I used the old style of hand-crafting the DOM on the client-side with Ta-da List and was quite disillusioned at the mess of browser differences and the sheer effort it took. Basically, each sliver of Ajax was a project in itself.

With Honey, though, I’ve been all over the new Ajax style that Rails affords. And what a difference it makes! It’s basically no harder to make something Ajaxed than it is not to, which means that the decision is based on whether its a good fit for the user interface — not on whether we have time to another Ajax project.

It is indeed very cool how they have taken out the need to really WRITE dHTML in your apps.

Read more about this release at: Rails 0.11.0: Ajax, Pagination, Non-vhost, Incoming mail

Check out the movie, which shows you how to setup a form to use Ajax in Rails.

Posted by Dion Almaer at 12:52 pm

3.7 rating from 7 votes


Comments feed

I read the blog post that you link to, and this does sound like a nice release of Rails. Lots of good new features.

Since it does predate this weblog, I’d like to mention that Nevow (previously Woven) on Python has a similar feature called LivePage. In addition to making it easy to modify the DOM (also using innerHTML) based on client requests, LivePage is also set up to allow the server to send back messages as long as the browser is still pointing at that page.

Comment by Kevin Dangoor — March 23, 2005

Sending the whole DOM tree is not a good idea especially when you do frequent requests (timer) in a very long page. In Nevow LivePage, the server sends back the javascript code which will be eval’ed by client–a really simple solution.

The same approach is used in http://srid.bsdnerds.org/hacking/wallaby/

Comment by Sridhar Ratna — March 28, 2005

Leave a comment

You must be logged in to post a comment.