link_to :confirm displays popup twice

后端 未结 16 1924
感情败类
感情败类 2020-11-30 02:38

This tag with rails 3

<%= link_to \'Destroy\', item, :method => :delete,:confirm=>\'Are you sure?\' %>

produces this html

16条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-30 03:18

    I've been used to include the javascript_include_tag at the bottom of my haml-layout-file.

    With Rails4 and Turbolinks it happens that:

    • Everything ok on the first load of a page (popup for confirmation appears only once)
    • Visiting another page -> popup occurs twice
    • Visiting one more page -> popup occurs three times
    • and so on
    • until I reload the page.

    I solved the problem by moving the javascript_include_tag from the bottom into

提交回复
热议问题