Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How change jquery version with rails asset pipeline

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?

like image 808
Lesha Pipiev Avatar asked Jan 22 '13 13:01

Lesha Pipiev


2 Answers

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.

like image 159
Nishant Avatar answered Sep 22 '22 01:09

Nishant


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

like image 32
konyak Avatar answered Sep 20 '22 01:09

konyak