Friday, May 12th, 2006

Ajax Experience Day 3: Stuart Halloway on Ajax for Rails

Category: Prototype, Ruby, The Ajax Experience

Notes from Stuart Halloway’s talk on Ajax support for Ruby on Rails at The Ajax Experience.

Who here is using Rails in here? About 10 people.
Who here is considering using Rails? Half of the room (about 40 people).

For a while, Stuart has been giving two bids to clients: one for Rails, one for Java. Every time, client chooses Rails.

Stuart has a great presentation style for something like this – since there are so many concepts here – Ruby, Ajax, Rails, Scriptaculous – he reasons it’s difficult to delve too much into the theory, so he focuses on building live demos and taking questions as they come up.

Stuart demoes rapidly building a GUI with scaffold. In 5 minutes, we’ve built and demo’d this app to manage a list of users. BUT it’s trivial, not customised, and not Ajaxified.

Q: What platforms does Rails run on?
A: All major platforms. There are a couple of related projects to Rails, which have had a big impact on its development – InstantRails (Windows Rails in one click). Mac – Locomotive, same thing, though many Mac users tend to install Rails using Gems.

All the source code for today’s pres and much more at

Demo of Active Record.

View: Controller sets up attribute. Demo of autocomplete.

Searching demo.

Q: Tied to using Scriptaculous?
A: No. Can use any, but because Rails has helper libraries, much easier. I’m worried about this – I’d like to see an aspiring programmer write helpers to let you work with Dojo. Existing is already “Good Enough” – we have a danger that Dojo/Scriptaculous/Mochikit is “good enough” and won’t be able to switch around.

Q: What if we could make helper methods generic?
A: That’s kind of what I’m describing – implementation would be different, but with the same name.

Q: Versioning issues with Rails and Scriptaculous/Prototype being kept out of sync?
A: No. (A) Because projects work together; (B) Plenty of automated testing. There’s a rake task to “updatejavascripts” that will ensure your JS is current. Would only be a problem if the developer/organisation wasn’t willing to move forward with both at the same time.

Sorting Demo

Drag-And-Drop Demo

Server-Side Validation input demo

“DivDows” Demo – floating windows-like divs. Relevance (Stuart and Justin’s company) will be rolling out an open-source project in about 60 days to support this. Currently Javascript-based, as shown below, but will eventually be able to use only Ruby.

win2 = new Window("show_win_" + user, {...})

Discussion on RJS and how useful
RJS: page.alert(“someMessage”)
Sometimes, no need – the RJS feature is purely there for the library to use internally, no reall reason to use it. Why use page.assign() when you could just set a variable?
Rjs Templates: How much to use?

For more info: “Ajax Labs”
Mail Stuart

Posted by Michael Mahemoff at 1:40 pm
1 Comment

3.7 rating from 24 votes

1 Comment »

Comments feed TrackBack URI


ajax_labs file doesn’t exist on codecide anymore. So i wonder if anyone can email me that zip file because im very interested in learning ajax on rails. you can contact me at


Comment by Jason — August 27, 2006

Leave a comment

You must be logged in to post a comment.