Currently:

Chad Fowler

Author, Speaker, Programming Lifestyle Engineer

Required Reading

Speaking/Lecturing Appearances

Mar 7-10
Pragmatic Rails Studio II
Santa Clara, CA
Mar 29-31
Pragmatic Rails Studio
Reston, VA
Apr 1-2
Ruby Nation
Reston, VA
Apr 6-8
Scottish Ruby Conference
Edinburgh, Scotland
Apr 22-23
Red Dot RubyConf
Singapore
May 16-19
RailsConf
Baltimore MD
May 28-29
RubyConf India
Bangalore, Karnataka, India
Jun 16-18
Nordic Ruby
Gothenburg, Sweden
Sep 11-14
SpeakerConf
Rome

Want me to speak at your event? Email me.

Blog Topics

career

life

software

rails

ruby

education

management

web

success

books

writing

job

metrics

quality

art

weightloss

development

programming

Search

How Rails Developers do Ajax (with jQuery) in 2011

Wanting to survey what the current state of the art in Rails Ajax development is, I asked this question on twitter:

Rails developers, how are you doing Ajax with JQuery these days? .js.erb templates? Rendering partials back old-style?

I got a lot of great responses! 44 last time I checked. Here’s what I found out people are doing:

  • mustache.js
  • Sending JavaScript back down to the client using .js.erb template files (Ryan Bates linked a couple of examples here and here)
  • JQuery templates
  • Hitting RESTFUL endpoints and responding with JSON data to be manipulated on the client
  • Using backbone.js
  • Rendering partials and updating elements on the page with their raw content (the original old-school Rails way of doing it)
  • Use SammyOnRails

There is definitely a divide and a lot of opinion (suprise!) between those who are OK with delivering JavaScript and/or HTML from the server to be rendered on the client and those who prefer to deliver data and have the client process it. I’d characterize the former as the less clean, more pragmatic approach and the latter as the idealistic cleaner approach. It seems that tools like mustache.js, backbone, JQuery templates, and Sammy.js are tightening the gap between quick + dirty and slow + clean.

What do you think? What did we miss?