I want use jQuery in my project. I know the javascript_include_tag calls the jQuery plugins, but the <script type="text/javascript"> tag how does it work in ruby?
Example
<%= javascript_include_tag 'jquery.ui.potato.menu.js' %>
<%= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js' %>
<script type="text/javascript">
(function($) {
$(document).ready(function(){
$('#menu1').ptMenu();
});
})(jQuery);
</script>
This is not working in RoR
You need to reverse your script tags, like this:
jQuery needs to be loaded before anything that depends on jQuery tries to run, e.g. plugins.
Also consider upgrading if you’re just getting started. If the plugin you’re using support it, the latest (as of the time of this answer) is 1.4.2.