How much JavaScript do you let Rails generate?

If you prefer jQuery you can use the jQuery on Rails Project. A drop in to replace Prototype with jQuery.

Some of what Rails does with Javascript generation is good and some is bad. In the bad instances, write it yourself and keep it unobtrusive. At any given time you're uncomfortable with the Javascript Rails generates, you can go ahead and write it yourself.

And be sure to check out this great intro to unobtrusive Javascript that was done with Rails in mind.


I used to work in Symfony (a Rails clone) and at first, we used a lot of Javascript helpers. Client requirements led us (me!) to have to write a lot of code the helpers just couldn't generate. I eventually came to the conclusion that I prefer not to use helpers at all.

Progressive enhancement is the way to go, in my opinion. Generate standards-friendly HTML that works without JavaScript enabled, then pile on the fancy functionality on document ready.

By the way, I've also switched from Prototype to jQuery and have no desire to switch back! In my opinion, jQuery is better suited to progressive enhancement.