jQuery! For Rails! So great.
This gem provides:
- jQuery 1.8.0
- the jQuery UJS adapter
- assert_select_jquery to test jQuery responses in Ruby tests
Apps generated with Rails 3.1 or later include jquery-rails in the Gemfile by default. So just make a new app:
rails new myapp
If upgrading from an older version of rails, or for rails 3.0 apps, add the jquery-rails gem to your Gemfile.
bundle install. The rest of the installation depends on
whether the asset pipeline is being used.
Rails 3.1 or greater (with asset pipeline enabled)
The jquery and jquery-ujs files will be added to the asset pipeline and available for you to use. If they're not already in
//= require jquery //= require jquery_ujs
//= require jquery-ui
In order to use the themed parts of jQuery UI, you will also need to supply your own theme CSS (or use the jquery-ui-rails gem mentioned above).
Rails 3.0 (or greater with asset pipeline disabled)
This gem adds a single generator:
jquery:install. Running the generator will remove any Prototype JS files you may happen to have, and copy jQuery and the jQuery-ujs driver for Rails (and optionally, jQuery UI) to the
To invoke the generator, run:
rails generate jquery:install #--ui to enable jQuery UI
Feel free to open an issue ticket if you find something that could be improved. A couple notes:
If the jquery or jquery-ui scripts are outdated (i.e. maybe a new version of jquery was released yesterday), feel free to open an issue and prod us to get that thing updated. However, for security reasons, we won't be accepting pull requests with updated jquery or jquery-ui scripts.
Many thanks are due to all of the jquery-rails contributors. Special thanks to JangoSteve for tirelessly answering questions and accepting patches, and the Rails Core Team for making jquery-rails an official part of Rails 3.1.
Copyright André Arko, released under the MIT License.