如何使用Rails资产管道更改jQuery版本 [英] How change jquery version with rails asset pipeline
问题描述
application.js
application.js
//= require jquery
//= require jquery_ujs
//= require_tree .
//= require active_scaffold
在客户端上
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-ui.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-ui-timepicker-addon.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery/active_scaffold.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery/jquery.editinplace.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery/date_picker_bridge.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery/draggable_lists.js?body=1" type="text/javascript"></script>
<script src="/assets/active_scaffold.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
/assets/jquery.js?body=1包含v1.9.0的jquery,但我希望有1.6版的jquery.
/assets/jquery.js?body=1 contains jquery of v1.9.0 but I wish to have a 1.6 version of jquery.
如何使用Rails资产管道定义jquery版本?
推荐答案
jQuery for Rails的支持来自宝石 jquery-rails
Support of jQuery for Rails comes from the gem jquery-rails
当您执行rails new {app}
时,默认情况下会包含此gem.以及application.js中的相应include语句
When you do a rails new {app}
it would by default have included this gem. and the respective include statements in application.js
-
来自 jquery-rails github自述文件最新版本支持.
jQuery 1.9.0
jQuery 1.9.0
如果对1.6.2的支持很好,那么您可以查看此下拉菜单请求查看它何时被包含,并包含该版本的jquery-rails.主要是1.0.12
If support for 1.6.2 is fine then you can look at this pull request to see when it got included, and include that version of jquery-rails. Mostly 1.0.12
作为最后的选择-最好删除该gem并将其直接导入assets/javascripts
或从网上引用它们.
As a last resort - it would be better if you remove this gem and directly import these into assets/javascripts
or reference them from the web.
这篇关于如何使用Rails资产管道更改jQuery版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!