Take the 2-minute tour ×

I am not trying to make this a preference question, I am really wondering what people's experiences are with using jQuery and Rails or jRails for development. Most rails users including myself up to now have been using Prototype. However, I am mixing in a lot of jQuery plugins since they are so easy to use and extend.

I am now thinking about moving from Prototype to jQuery for a new Rails project. However, I love the Power of Prototype. Protoype is almost a new language that sites ontop of JS whereas I find that jQuery is like a great scripting language with lots of syntax sugar and chaining.

Anyway, your thoughts would be much appreciated.

share|improve this question
add comment

3 Answers

up vote 8 down vote accepted

In Rails it really all comes down to the helper methods. Are you using any prototype helper methods? If so then you must use jRails to switch to jQuery. But if not then it really does not matter. They are both great. I used prototype a lot before and it is great. But I prefer the selector way of doing things with jQuery so I have switched. Another good reason to not use the helper methods is unobtrusive javascript. The rails helper methods creates messy inline code.

share|improve this answer
with Rails 3 the helpers will generate unobtrusive JS –  Kevin Davis Feb 8 '10 at 4:28
add comment

jRails is great if you are using rjs templates if you want to maintain a "consistent" codebase between generated and handwritten. However, I personally have seen jRails not know how to really decently handle ajax form generators.

My biggest recommendation is to have jRails for "when you need it", and get more comfortable with writing JavaScript by hand. Prototype and jQuery are really two completely different schools of thought, and they aren't necessarily compatible. At first, I was a huge Prototype advocate, because a ton of my Ruby design knowledge was transferable, however I have learned to use jQuery in a much more robust way, using jQuery to empower more natural JavaScript.

share|improve this answer
add comment

Do you use prototype for things other then the rjs files and other javascript helpers? If so then you will need to determine if you want to rewrite thoose in jQuery. Otherwise, you can just use jRails to take care of any rjs helpers and you will not even notice a difference.

I have been using jRails and love it!

share|improve this answer
add comment

Your Answer


