2012-04-23 43 views
2

我有一個Rails 3.1的應用程序的Rails + jQuery的ajaxPrefilter

在我的Gemfile:

gem 'jquery-rails', '>= 1.0.12' 

在我的資產/ application.js中,我有:

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

在我的應用程序。 html佈局,我已包括這些行

<%= javascript_include_tag "application" %> 
<%= javascript_include_tag "jquery.min" %> 

我正在使用jQuery v1.6.2。

問題是,當我嘗試訪問任何網頁,我一直在控制檯收到這些錯誤:

Uncaught TypeError: Object function (selector,context){return new jQuery.prototype.init(selector,context);} has no method 'ajaxPrefilter' (:3000/assets/jquery_ujs.js?body=1:290) 

Uncaught TypeError: Cannot read property 'setOffset' of undefined (:3000/assets/jquery-ui-1.8.18.custom.min.js?body=1:37) 

Uncaught TypeError: Object function (a,b){return new jQuery.prototype.init(a,b)} has no method 'ajaxPrefilter' (application.js:12) 

什麼是ajaxPrefilter,以及如何解決這些錯誤?

我試着在application.js之前加載jquery.min.js對javascript進行重新排序,沒有運氣,我不確定如何檢查js文件本身的錯誤。

回答

0

試試這個:

<%= javascript_include_tag "application" %> 
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" %> 
<%= javascript_include_tag "http://code.jquery.com/ui/1.8.19/jquery-ui.min.js" %> 
+1

謝謝,我已經試過那些臺詞,但我仍然得到同樣的錯誤: jquery_ujs.js:290 - 遺漏的類型錯誤:對象功能(選擇,背景){回報(a,b){return new e.fn.init(a,b) ,h)}沒有方法'小部件' application.js:12 - 未捕獲TypeError:對象函數(a,b){返回新的jQuery.prototype.init(a,b)}沒有方法'ajaxPrefilter' – 2012-04-24 08:21:53