Alexander Kireyev
Alexander Kireyev

Reputation: 10825

jquery:install doesn't work in Rails

I have installed gem jquery-rails in Rails 3.1 app. But line below

rails generate jquery:install --ui

Getting error:

Could not find generator jquery:install.

Upvotes: 2

Views: 2064

Answers (2)

Arivarasan L
Arivarasan L

Reputation: 9948

for Rails 3.0.x application do the below steps,

  • Add gem “jquery-rails”, “~> 1.0.13″ in your Gemfile, and run bundle install

  • run the command rails generate jquery:install --ui --force, it will remove prototype.js, effects.js, dragdrop.js, controls.js and create jquery.js, jquery.min.js, jquery-ui.js, jquery-ui.min.js, jquery_ujs.js

to use jquery functions add the below lines in the application.js

//= require jquery
//= require jquery_ujs

Upvotes: 0

Gazler
Gazler

Reputation: 84140

In rails 3.1, because jquery is the default, you no longer need to install it, it will be required in app/assets/jquery/application.js and it will look something like:

//= require jquery
//= require jquery_ujs
//= require_tree .

You can verify which generators are available by executing rails g without anything else:

rails g

Upvotes: 5

Related Questions