Rails JS best practices? (jQuery + Prototype / MooTools

CoffeScript

I like CoffeeScript and already tried it :). But as it said before, it's
supposed to be used with another libraries.

Hey, I’m the author of the CoffeeScript book from PragProg. I noticed this conversation and thought I’d stop by.

CoffeeScript goes great with either Prototype or jQuery. (One chapter of my book is a primer on jQuery.) As Walter said, while it’s possible to use both Prototype and jQuery on the same web page, it’s generally not very efficient because both libraries offer much of the same functionality. Prototype has traditionally had a large following among Rubyists because it provides lots of Ruby-like idioms. But jQuery is much more widely used and actively updated than Prototype, and is the official JS library as of Rails 3.1—even though the creator of Prototype, Sam Stephenson, works for 37signals. (He’s also become a strong advocate of CoffeeScript and was a technical reviewer for the book.)

So, in short, I’d suggest sticking with CoffeeScript + jQuery. If you miss Rails’ functional programming goodness, check out Underscore.js. And if you feel like modifying native prototypes (e.g. adding an uppercase method to all strings), feel free. Check out how Prototype does it: https://github.com/sstephenson/prototype/tree/master/src/prototype/lang

If you have any questions, you can always find me on Stack Overflow.