David Welton: One Year of Rails, on_idle plugin
I've been using Rails for about a year, and I am, in general, quite satisfied. It really is a big step forward in terms of web programming, and I've found the whole experience very enjoyable. In a year I've managed to crank out a number of sites in my spare time (in between various other activities such as the occasional bike ride and Hecl hacking):
- linuxsi.com - a site in Italian helping people to locate Linux-friendly computer retailers.
- builder.hecl.org - lets you create Hecl mobile phone applications from your web browser.
- libreriaminerva.it - a small bookstore in the center of Padova, specializing in rare and antique books and prints.
- stufftodo.dedasys.com - my own vision of an ajaxy todo list that plays nicely in a business environment, where it's important to be able to share tasks.
./script/plugin install http://svn.dedasys.com/public/on_idle
It's just a few lines of Javascript code that are wrapped up in a way that makes it trivial to use from Rails views:
def on_idle(timeout, options, wakeoptions)
<%= on_idle(600, :url => :action => 'notify_idle' ,
:url => :action => 'notify_wake' ) %>
timeout: the number of seconds before the user is considered 'timed out'.options: the action to perform when the user goes idle.wakeoptions: what to do when the user 'wakes up'.