8

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.

hectorsq
  • 74,396
  • 19
  • 43
  • 46

5 Answers5

6

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
  • 18,340
  • 6
  • 53
  • 62
2

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
  • 7,066
  • 5
  • 30
  • 38
1

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
  • 36,755
  • 28
  • 133
  • 162
0

JRails did not work out of the box for me when i was migrating Rails 3+RJS from Prototype to JQuery. So i just did monkey-patching with fragment of JRails not using the rest of it, like described here

Alexey
  • 9,197
  • 5
  • 64
  • 76
-7

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
  • 298
  • 2
  • 6
  • 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 Oct 29 '08 at 05:15
  • if you are not using prototype, scriptauclous, REST, MVC ideas, partials and migrations then it is NOT Rails at all. – IDBD Oct 29 '08 at 06:24