5

I am using Rails 3.1 and having an issue with the jQueryUI library. Here is my application.js file:

//= require jquery
//= require jquery-ui
//= require jquery_ujs
// Loads all Bootstrap javascripts
//= require bootstrap
//= require rails.validations

//= require_tree .

It loads the "jquery ui" file into the browser, but whatever I use related to it it shows this error:

TypeError: Object function (a,b){return new d.fn.init(a,b,g)} has no method 'dialog'

3 Answers 3

3

I had the same problems, application.js looked like this:

//= require jquery
//= require jquery_ujs
//= require jquery-ui

In development mode, it seems /assets/application.js contained a version of jQuery bundled with ujs, and, when added to the page, it was like this:

<script src="jquery"></script>
<script src="jquery_ujs"></script>
<script src="jquery-ui"></script>
<script src="application.js"></script>

The last file was overriding the first three files. I put:

//= require_self
//= require jquery-ui

and it works fine.

The funny thing is, application.js only contains require lines, no jQuery or ujs.

Sign up to request clarification or add additional context in comments.

1 Comment

Not sure why/how/when I'd removed require_self to begin with, but adding it back to the top fixed my issue. Thanks!
2

You might have precompiled your assets at an earlier point. Try to remove everything under public/assets.

Comments

2

After hours of struggling with the issue, I finally removed //= require jquery-ui from application.js and added the new jQuery UI file, and everything works fine now. My new asset file is:

//= require jquery
//= require jquery/jquery-ui
//= require jquery_ujs
// Loads all Bootstrap javascripts
//= require bootstrap
//= require rails.validations

//= require_tree .

jquery is a sub-folder in my javascripts folder.

Comments

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.