Thursday, February 10, 2005


rails_logo_remix_small.gif I’ve been playing around with Rails. So far, I really enjoy it. I was able to throw together a build tool for work in one evening. Which is really impressive considering what all it does. Oh, and I developed it on my Mac, dropped it on my PC server and it just worked! Take that Java.

I’ve been using the XMLHttp stuff for a couple of years at work (long before Google made it popular :-P). But I’ve never really looked at JSON until recently. It seems like a really nice format for use with “rich” web applications. It should be faster than XML and a lot easier to handle.

Along that vein, I’ve been testing some javascript classes I’ve made to help in talking with Rails. The RailsConnector class just calls a Rail Action and returns the results. JsonConnector acts the same, but evaluates the results as JSON. There is also support for asynchronous calls. They’re working great on Safari and Firefox, I haven’t tested on Internet Explorer.


JsonConnector(controller, action[, callback])
RailsConnector(controller, action[, callback])

The parameter callback is optional, if you pass it a function the Connector will execute asynchronously.


.add(key, value)

Both classes have the same method signatures. The .add() .get() .remove() and .clear() methods are used for setting parameters to send to the Rails action.

I’ll probably post some examples pretty soon.