Could not find generator jquery:install

Problem
When you try to replace prototype with jquery in your Rails 3.0.x application, by using the command described in the Agile Web development book:

rails generate jquery:install --ui --force

you get the following error:

Could not find generator jquery:install

Solution
You would need to follow the steps below:

  1. Add gem “jquery-rails”, “~> 1.0.13” in your Gemfile, and run bundle install
  2. run the command described above: rails generate jquery:install –ui –force

Now you should be able to see something like:

remove public/javascripts/prototype.js
remove public/javascripts/effects.js
remove public/javascripts/dragdrop.js
remove public/javascripts/controls.js
copying jQuery (1.6.2)
create public/javascripts/jquery.js
create public/javascripts/jquery.min.js
copying jQuery UI (1.8.14)
create public/javascripts/jquery-ui.js
create public/javascripts/jquery-ui.min.js
copying jQuery UJS adapter (cd619d)
remove public/javascripts/rails.js
create public/javascripts/jquery_ujs.js