When I use a javascript_include_tag for both jQuery and Rails’ :defaults, the latter one seems to override the first.
For instance, when I put elements in this order:
<%= javascript_include_tag "jquery-1.4.min.js" %>
<%= javascript_include_tag :defaults %>
…I can execute an AJAX update with Rails but can do nothing with jQuery.
When I reverse the order of the javascript_include_tags, I can access jQuery but cannot run an AJAX request with Rails.
I prefer to do my AJAX Rails (as it entails less code on my part), but I wish also to make use of other jQuery features. Any idea what to do or where the conflict lies?
Rails 2.3.5,
jQuery 1.4
There are two easy solutions here. Use the jrails plugin. It will walk you through what you need to do.
Or use jQuery instead of $ in your jQuery code.
For example:
They will do the same thing but Rails uses Prototype which also maps the $ and therefore conflicts with jQuery.