Webreakstuff's blog on design, development and strategy. Click here to subscribe.

Rails 0.11.0, Ajax support on stable

Fred Oliveira on March 22, 2005 Comments (0)

For those running edge rails this may not be a new thing, but most people will be happy to know that Ruby on Rails 0.11.0 was released earlier today and packing quite a few new features, especially for those interested in Ajax development (that’s been getting quite some attention around here). So, Ajax support is now extremely simplified (check this impressive video by Sam Stephenson for an example of how to _ajaxify_ - oh hoh, i just invented a new term - a regular form).

Other additions and changes include pagination support, a new Flash module and a couple more things. You should head on to the release post on ror’s weblog and read all about it.

And if you want to get going with it right now, its a 3 step procedure for those running on 0.10.1 :

  • gem update
  • cd /path_to_rails_app
  • rails . –skip

mod_fastcgi and RoR with DarwinPorts

Fred Oliveira on March 21, 2005 Comments (0)

If you’ve seen my post on setting up Ruby on Rails using darwinports on OSX, you probably know what I’m about to describe. If you didn’t, this is an explanation of the steps required to install FastCGI in order to speed-up processing RubyOnRails when using apache. This installation is much easier and faster than the one mentioned on RoR’s docs.

This assumes you’ve completed the steps in the other post.

* Install fcgi: sudo port install fcgi
* Install mod_fastcgi: sudo port install mod_fastcgi
* Install ruby’s fcgi bindings: sudo gem install fcgi
* Load fastCGI on your apache: LoadModule fastcgi_module modules/mod_fastcgi.so
* Add the .fcgi handler:


    FastCgiIpcDir /tmp/fcgi_ipc/
    AddHandler fastcgi-script .fcgi

Now all you have to do is restart apache (sudo /opt/local/apache2/bin/apachectl restart) and you’re done. You still have to edit your rails apps to use fastCGI instead of mod_ruby, though, with the two steps described on RoR’s documentation.


Form accessibility with XMLHttpRequest

Fred Oliveira on Comments (0)

Thomas Baekdal did a great write-up on usability with XMLHttpRequest-powered forms on his website. Highly recommended if you’re building applications powered by Ajax (on whatever language you develop in), because he covers things the untrained eye may miss sometimes, like the disbelief people show when stuff happens instantaneously (which is the point of Ajax in the first place).

One *small* addition to Thomas’s write-up is the need for a global completion label when we’re doing forms with Ajax. He does write about the need to highlight the active element, and to visually indicate data for that specific element has been saved (as you can clearly see on his example), but with no real feedback when someone’s completed the process - in whatever kind of form, not just his example -, the end user will never be absolutely sure.

You should have a look at his article.


Tackling XMLHttpRequest (Ajax)

Fred Oliveira on Comments (0)

Unless you’ve been under a rock for the last 3 or 4 months or you’ve got nothing to do with web development, you’ve heard about it out there. XMLHttpRequest (only one of the faces of Ajax, but probably the most important) is causing a massive hype. Why? Because it allows developers to create web applications that respond to user interaction like a desktop app would.

Instead of going through weird explanations, a few examples are GMail’s interface, the recently yahoo-acquired oddpost and A9 search at amazon. Whats common about all those? The page instantly responds to user requests like searching for pages, opening an email message, etc, requiring no browser refreshes. If you’re interested in why that happens, the great guys over at Adaptive Path wrote a pretty interesting essay on Ajax that you should definitely have a look at.

Explanation: Basically instead of having the server and client communicate only when the user clicks something, ajax provides a third layer between client and server that communicates with the server and maintains the page updated on the fly. Think of it as the middleware that gets your data and puts it on screen instantaneously, without requiring a page refresh.

Using Ruby on Rails that I’ve covered before, I’ve began to deploy ajax-based sollutions into some of my current projects, and I must say this is fascinating turf. It ain’t about exploring a new technology (because neither Javascript, XML or the DOM are new), but about using existing technologies to build what you might call a glimpse of the future. More on my experiences with Ajax in the future.

Oh, and if you’re (still) using PHP to develop your web applications there are already a couple of helping classes for Ajax-deployment: sajax and jpspan. Have a look at those too.