在Rails中调试jQueryUI版本 [英] Debug jQueryUI Versions in Rails
问题描述
在我的Rails项目中,我用于排序<li>
元素列表的旧jQuery代码已损坏.记录的错误是:
Within my Rails project, my old jQuery code for sorting a list of <li>
elements has broken. The logged error is:
TypeError: $.ui.isOverAxis is not a function
我认为罪魁祸首是 jquery-ui.js (v1.9.2)的不需要的较旧版本正在将其放入标头中,并且我不知道如何删除它.
I think the culprit is that an unwanted, older version of jquery-ui.js (v1.9.2) is making it into my headers, and I don't know how to remove it.
不需要的jQuery文件源自jquery-rails
gem.我不明白为什么,因为我已经从我的 application.js 文件中删除了//= require jquery-ui
行.
The unwanted jQuery file is originating from the jquery-rails
gem. I don't understand why, since I've removed the //= require jquery-ui
line from my application.js file.
这是我当前的 application.js 文件:
//= require moment.min.js
//= require nicEdit.js
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require_tree .
我的Gemfile已更新为jquery-rails
gem(2.2.1)和jquery-ui-rails
gem(4.0.3)的最新版本.
My Gemfile is updated to the most recent versions of the jquery-rails
gem (2.2.1) and the jquery-ui-rails
gem (4.0.3).
但是在开发模式下,较旧版本的jquery(1.9.2)出现在我的头文件中:
Yet an older version of jquery (1.9.2) appears in my header files in development mode:
<script type="text/javascript" src="/assets/jquery-ui.js?body=1"></script>
通过在开发模式下进行调试,我可以确定 jquery-ui.js 文件来自jquery-rails
gem.
Through debugging in development mode, I can tell that the jquery-ui.js file comes from the jquery-rails
gem.
关于如何解决此问题的任何建议?
Any suggestions on how to fix this?
更新
我已经更新了问题以反映我的发现,即 jquery-ui.js 文件实际上来自jquery-rails
gem.
I have updated the question to reflect my discovery that the jquery-ui.js file is, in fact, coming from the jquery-rails
gem.
推荐答案
看来ActiveAdmin正在调用//= require jquery-ui
,这反过来又从
It appears that ActiveAdmin is calling //= require jquery-ui
, which is in turn pulling in the jquery-ui.js file from jquery-rails
.
该文件正在破坏jquery-ui-rails
中的jQueryUI版本.
That file is clobbering the version of jQueryUI from jquery-ui-rails
.
长期解决方案可能是jquery-rails
删除 jquery-ui.js 文件或至少将其重命名.
The long-term solution might be for jquery-rails
to remove the jquery-ui.js file, or at least rename it.
在短期内,我通过删除//= require jquery.ui.all
并完全依靠jquery-rails
完全跳过了jquery-ui-rails
来解决了我的问题.
In the short-term, I solved my problem by removing //= require jquery.ui.all
and relying entirely on jquery-rails
, skipping jquery-ui-rails
altogether.
这篇关于在Rails中调试jQueryUI版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!