The One-Two Punch: jQuery with Rails
Location: Saal Maritim B Level: Intermediate
What do Google, AOL, Amazon, Slashdot, Digg, and Technorati all have in common?
That they’re extremely popular websites?
They’re using it, and so are many Rails developers, because it helps both new and seasoned developers throw together rich-media applications in much the same way that Rails helps build server-side applications.
In recent versions, jQuery has added features that allow it to communicate directly with Rails in the same way that the built-in Prototype library does.
What makes jQuery really shine is its plugins (of which there are literally hundreds). They integrate seamlessly into the library, providing high-level functionality like drag-and-drop and autocompletion, and low-level functionality like templating. And of course, they all leverage the core jQuery philosophy that makes the library so popular.
In fact, many new jQuery users find themselves writing simple “plugins” in the first few days they use the library.
What’s cool about jQuery
- Fully namespaced in the jQuery global, so it works seamlessly with other libraries
- No extension of native prototypes or DOM objects, so there’s no risk of conflict with libraries behaving irresponsibly
- Centered around the DOM, making DOM-scripting easy
- Focuses on pragmatic solutions to everyday problems, instead of theoretical programming
- Small (15k gzipped)
- Can be easily extended via plugin, including stuff like the animate function (to provide animations for properties not supported by default)
Find out why so many new developers fall in love with jQuery!
Yehuda Katz is a core team member on the DataMapper project, and the creator of the DO.rb project. He is a contributor to the Merb and Rubinius projects, and is a contributing author for the upcoming Manning Publications book Ruby in Practice. He recently accepted a job at EngineYard. He has been working on Ruby on Rails applications since 2005, and has just spent a year working on a very large and complex data-driven Rails app (http://procore.com).
He also does front-end web work, is a coauthor of the Manning book jQuery in Action and a core team member of the jQuery project.