views:

1422

answers:

4

I am planning to use jquery in Rails instead of prototype.

I am not sure to use jRails or to use plain jquery and stay away from RJS.

What do you think about this?

EDIT: Two weeks later I found this http://www.loudthinking.com/posts/32-myth-3-rails-forces-you-to-use-prototype

EDIT: This screencast is interesting too.

+4  A: 

If you ask me, staying away from RJS is a great idea. RJS is an amazingly cool hack, but for production code it's a pain to test and debug. I recommend sticking to UJS (Unobtrusive JavaScript), and jQuery is a great way to do UJS.

Avdi
+1  A: 

I use JRails and it is exc ellent.

I think there is some value to be hand with using RJS for simple operations ... much of the out-of-the-box functionality works great for simple use-cases and it helps you get a finished product out the door fast. You can always convert code at a later stage.

Toby Hede
A: 

Prototype and Scriptaculous are parts of Rails framework. IMHO, you can remove these libraries and insert others but then it will be not Rails framework and Rails project.

The other variant is to add jQuery to the standard Rails configuration. After that you have to fix few compatibility problems between these libraries. jQuery have published small script that make it.

IDBD
as with any framework, you don't have to use all the features including rails' *support* for prototype/scripty. so it doesn't follow that removing proto/script from rails means it's no longer rails.
Alan
if you are not using prototype, scriptauclous, REST, MVC ideas, partials and migrations then it is NOT Rails at all.
IDBD
+1  A: 

I second using jQuery without the help of Rails using unobtrusive Javascript as a technique. I would recommend using the Low Pro library to set up behavior controllers to bind CSS pseudo-classes (events) to your functions.

jQuery also does just fine without Rails for DOM manipulation.

Alan
I'll take a look at Low Pro, thanks.
hectorsq