Lone Star Ruby Conf 2008: Using jQuery with Ruby Web Frameworks
jQuery has become incredibly popular, in large part because it makes Unobtrusive JavaScript brain-dead trivial. It’s also very small, under 25k in total, and its Ajax library is fully compatible with the way both Rails and Merb handle content-type negotiation. Its simplicity and DOM-centric approach are a perfect companion to the DRY approach taken by Ruby web frameworks.
This talk will first walk you briefly through the basics of the jQuery framework. The bulk of the talk, however, will be an intense, code-centric review of the best ways to integrate jQuery into the Ruby web framework of your choice. We will cover how to write helpers that can leverage the fact that jQuery operates on semantic HTML (we’ll use classes and other HTML attributes to provide information to a single application-wide JavaScript file). And we will cover tiny pieces of glue code that can give you all the features of the built-in helpers and RJS with even less code than you’d otherwise need.
In short, this is a crash course in how to marry the rapid development approaches that are the core of both Ruby web frameworks and jQuery to build a super-charged environment for quickly prototyping applications. And because Ruby on Rails and Merb are very similar, we’ll be able to cover both web frameworks in a single talk.