Skip to content
Ruby on Rails unobtrusive scripting adapter for jQuery
JavaScript Ruby HTML Shell
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
src
test
.gitignore
Gemfile
README.rdoc

README.rdoc

jquery-ujs

Unobtrusive jQuery with Rails 3

Installation

jQuery 1.4, 1.4.1 and 1.4.2 can be used. However because of jsbin.com/uboxu3/7/ issue it is recommended to use jQuery 1.4.1.

Step 1

Download jQuery from docs.jquery.com/Downloading_jQuery and put the file in public/javascripts - for example, the file might be:

public/javascripts/jquery-1.4.1.min.js

Step 2

Copy rails.js from github.com/rails/jquery-ujs/raw/master/src/rails.js 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)

Testing

Installation

$ 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.