You are here

Ruby on Rails with JQuery

Ruby on Rails comes by default with the Prototype and Script.aculo.us Javascript Frameworks enabled to be used in AJAX calls and visual effects.
Well, some people might prefer to use the JQuery framework instead of those two. It is pretty simple to make the change in rails and still use the prototype helpers. All you have to do is use the jRails plugin which is "a drop-in jQuery replacement for the Rails Prototype/script.aculo.us helpers".

To install jRails simply type the command below and all the needed files will be copied to your project:

ruby script/plugin install http://ennerchi.googlecode.com/svn/trunk/plugins/jrails
+ ./CHANGELOG
+ ./README
+ ./init.rb
+ ./install.rb
+ ./javascripts/jquery-ui.js
+ ./javascripts/jquery.js
+ ./javascripts/jrails.js
+ ./javascripts/sources/jrails.js
+ ./lib/jrails.rb
+ ./tasks/jrails.rake
Copying files...
Files copied - Installation complete!

You know what's great? The defaults javascript include will continue to work, so you don't need to change this from your application.html.erb:


Don't forget to remove the prototype and scriptaculous files from your javascripts folder. You will probably not need them anymore!