How change jquery version with rails asset pipeline

痴心易碎 提交于 2019-12-22 05:33:18

问题


application.js

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

on client

<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 contains jquery of v1.9.0 but I wish to have a 1.6 version of jquery.

How define jquery version with rails asset pipeline?


回答1:


Support of jQuery for Rails comes from the gem jquery-rails

When you do a rails new {app} it would by default have included this gem. and the respective include statements in application.js

  1. From jquery-rails github README the latest version supports.

    jQuery 1.9.0

  2. 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

  3. 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.




回答2:


If you're using jquery-rails, here's the mapping (VERSIONS.md) of the bundled jQuery versions to the jquery-rails versions.



来源:https://stackoverflow.com/questions/14459161/how-change-jquery-version-with-rails-asset-pipeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!