Rails 3.1 with Asset Pipeline, link_to :confirm message showing twice?

江枫思渺然 提交于 2019-12-03 10:23:38

This has happened to me because I had run rake assets:precompile in my development environment causing public/assets/application.js to be created. This makes requests for /assets/application.js to be served by this static file which contains all // require scripts in public/assets/application.js compiled together, causing them to be loaded once again.

In development mode <%= javascript_include_tag "application" %> will expand in to multiple <script> tags, one for each file required by // require lines, and also one for application.js which only contain its own content.

Solution is to remove the whole public/assets directory manually or use the assets:clean rake task. This will cause scripts files to be served dynamically again.

This was happening to me too. Removing "//= require_tree ." from application.js fixed it.

Mention the name of jquery and jquery_ujs with version in application.js if still not workout then take compressed version of jquery and jquery_ujs.

or

Add gem 'jquery-rails' into your gemfile then try out.

Alfonso García

Probably you have the rails.js file. Remove it and try it again. It must work.

FoN

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