2

Since jquery is packaged with Rails 3.0, I'm using the jquery-ui-rails gem to get jquery-ui.

Looks like jquery_ujs is not packaged with Rails (or jquery-ui-rails). And I can't independently include jquery_ujs gem (there is no such gem, it is packaged with the jquery-rails gem ... which specifically states that I don't need this gem if I'm on Rails 3.0+).

I try to require jquery_ujs in my application.js but obviously it's not found.

So how do I get jquery_ujs?!

1 Answer 1

1

If you're including the jquery-rails gem in your Gemfile, then jquery-ujs is already installed. Simply make sure it's added to your application.js manifest like so:

//= require jquery
//= require jquery-ujs

And if you also have jquery-ui-rails, you can then add a manifest entry for that:

//= require jquery.ui.all
Sign up to request clarification or add additional context in comments.

3 Comments

So I'm not including the jquery-rails gem in my Gemfile because Rails 3.0 includes jquery by default. Then I include the jquery-ui-rails gem for jquery-ui. I ended up downloading the jquery_ujs.js file and then requiring it in my application.js file. things work now, please let me know if I should explicitly include the jquery-rails gem for some reason.
@RingoBlancke: "because Rails 3.0 includes jquery by default" - No, it doesn't. Not if you remove the gem 'jquery-rails' in your Gemfile that Rails had put there by default. You should absolutely include that gem if you're using jquery, unless you want to install a specific version of the jquery.js and jquery-ujs.js files manually.
Rails 3.0.6 does not include gem 'jquery-rails' by default. And it's pointless anyways, as there is no manifest for javascript. The asset pipeline, which uses the manifests, was introduced in Rails 3.1. @RingoBlancke probably came up with the best solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.