Skip to content
This repository

Ruby on Rails unobtrusive scripting adapter for jQuery

tree: 63a99e0582

Fetching latest commit…

Cannot retrieve the latest commit at this time



Unobtrusive jQuery with Rails 3

Automated Installation

Step 1

Add this line to your Gemfile:

gem 'jquery-rails'

Step 2

Run this command:

$ rails generate jquery:install # --ui if you want jQuery UI

Step 3

There is no step three.

Manual installation

jQuery 1.4, 1.4.1, 1.4.2 and 1.4.3 can be used. However because of issue which is present in jQuery 1.4.2 version, it is highly recommended to use jQuery 1.4.3.

Step 1

Download jQuery from and put the file in public/javascripts - for example, the file might be:


Step 2

Copy rails.js from into public/javascripts - overwriting the prototype one (you can also delete the other prototype files if you don't need them for anything else.)

Step 3 (optional)

Switch the javascript_include_tag :defaults to use jquery instead of the default prototype helpers.

file config/application.rb

config.action_view.javascript_expansions[:defaults] = %w(jquery rails application)



$ gem install bundler
$ bundle install

Running tests

$ bundle exec ruby test/server.rb

Visit localhost:4567 and all the tests should pass. If you want to change any settings then change the settings at the top of test/public/test/settings.js

Something went wrong with that request. Please try again.