Unobtrusive jQuery with Rails 3
The rails.js file from master branch supports following versions of jQuery:
If you are using one of the following version of jQuery then use branch v1.4 .
rails.js file from v1.4 branch can be accessed at github.com/rails/jquery-ujs/blob/v1.4/src/rails.js .
Add this line to your Gemfile:
Run this command:
$ rails generate jquery:install # --ui if you want jQuery UI
Step 3 (optional)
Uncomment following line from file config/application.rb
To load jQuery from a CDN such as Google, just specify the full path. Change the above to
instead of the default prototype helpers.
$ gem install bundler $ bundle install
$ 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 .