我有以下 Ruby 代码:
<%= link_to "Install", install_game_path(game), :remote => true, :confirm => "Download local content for #{game.name}?", :title => "Install #{game.name}", :id => "game_#{game.id}_install_link" %>
这会产生如下所示的代码行:
<a href="/games/install/3" data-confirm="Download local content for GAME 1?" data-remote="true" id="game_1_install_link" title="Install GAME 1">Install</a>
但是,在我的开发环境中,它会产生两个 Javascript 警报提示。我在 Firefox 中没有任何 Javascript/JQuery 错误。为什么这个对话框会出现两次(不管我是点击“确定”还是“取消”?
编辑
<%= javascript_include_tag "application" %>
<%= javascript_include_tag 'http://github.com/cowboy/jquery-dotimeout/raw/v1.0/jquery.ba-dotimeout.min.js' %>
生成此代码:
<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/games.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.ba-dotimeout.min.js?body=1" type="text/javascript"></script>
<script src="/assets/pages.js?body=1" type="text/javascript"></script>
<script src="/assets/servers.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
<script src="http://github.com/cowboy/jquery-dotimeout/raw/v1.0/jquery.ba-dotimeout.min.js" type="text/javascript"></script>
application.js 文件仅包含默认内容:
//= require jquery
//= require jquery_ujs
//= require_tree .