Although the title of the question is very similar to the previous ones, my problem seems different.
In short, the first element in the js manifest is included twice.
Here is my whole /app/assets/javascript/application.js file in a Rails 3.1 application:
//= require jquery //= require jquery-ui //= require jquery_ujs //= require autocomplete-rails //= require utilities
And here is a fragment of the provided page source:
<script src="/assets/jquery.js?body=1" type="text/javascript"></script> <script src="/assets/jquery.js?body=1" type="text/javascript"></script> <script src="/assets/jquery-ui.js?body=1" type="text/javascript"></script> <script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script> <script src="/assets/autocomplete-rails.js?body=1" type="text/javascript"></script> <script src="/assets/utilities.js?body=1" type="text/javascript"></script> <script src="/assets/application.js?body=1" type="text/javascript"></script>
Note that if I go to the top of any other line in application.js , for example:
//= require utilities //= require jquery //= require jquery-ui //= require jquery_ujs //= require autocomplete-rails
This is always the first element to be turned on twice!
<script src="/assets/utilities.js?body=1" type="text/javascript"></script> <script src="/assets/utilities.js?body=1" type="text/javascript"></script> <script src="/assets/jquery.js?body=1" type="text/javascript"></script> <script src="/assets/jquery-ui.js?body=1" type="text/javascript"></script> <script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script> <script src="/assets/autocomplete-rails.js?body=1" type="text/javascript"></script> <script src="/assets/application.js?body=1" type="text/javascript"></script>
UPDATE
As a temporary workaround, I added //= require dummy at the top of the list, which indicates an empty dummy.js file. Although it appears twice on the displayed page, it does not work because it does nothing. On the other hand, if I set config.assets.debug = false in development.rb , as is often suggested, then ALL of my javascript is loaded twice:
<script src="/assets/application.js" type="text/javascript"></script> <script src="/assets/application.js" type="text/javascript"></script>
and js work twice (for example, when deleting a model, confirmation dialogs appear twice)
Giuseppe