No description, website, or topics provided.
Switch branches/tags
Nothing to show
Pull request Compare This branch is 407 commits behind rails:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Unobtrusive jQuery with Rails 3

The rails.js file from master branch supports following versions of jQuery:

  • 1.4.3

  • 1.4.4

If you are using one of the following version of jQuery then use branch v1.4 .

  • 1.4

  • 1.4.1

  • 1.4.2

rails.js file from v1.4 branch can be accessed at .

Automated Installation

Step 1

Add this line to your Gemfile:

gem 'jquery-rails', '>= 0.2.6'

Step 2

Run this command:

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

Manual installation

Step 1

Download jQuery from and put the file in public/javascripts. For example, the file might look like:


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)

Uncomment following line from file config/application.rb

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

To load jQuery from a CDN such as Google, just specify the full path. Change the above to

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

Alternatively, you can specify the exact files to load in app/views/layouts/application.html.erb. Change javascript_include_tag :defaults to use jQuery

<%= javascript_include_tag 'jquery' %>
<%= javascript_include_tag '' %>

instead of the default prototype helpers.



$ gem install bundler
$ bundle install

Running tests

$ bundle exec ruby test/server.rb

Visit localhost:4567 and all the tests should pass.

At the top of the page you will see links to jQuery 1.4.3 and 1.4.4 . By clicking on those links you will be executing the tests against the clicked version of jquery. By default test uses jQuery 1.4.4 .