Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 3.1, jQuery UI does not load

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'
like image 836
Nazar Hussain Avatar asked Jan 08 '12 00:01

Nazar Hussain


2 Answers

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.

like image 95
Andrei Zisu Avatar answered Oct 18 '22 11:10

Andrei Zisu


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

like image 45
urandom Avatar answered Oct 18 '22 11:10

urandom