gpt4 book ai didi

ruby-on-rails - :confirm is generating two confirm messages

转载 作者:数据小太阳 更新时间:2023-10-29 08:13:27 25 4
gpt4 key购买 nike

我正在使用以下代码:

<li class="dele-yaniv"><%= link_to "delete", order, :method => :delete,
:confirm => "You sure you want to delete " +order.name+"?",
:title => order.name %></li>

当用户单击删除链接时,他会收到一条确认消息“您确定要删除吗?”

点击确定后,另一条消息再次出现,第二行“复选框阻止此页面创建其他对话框

发生了什么事?

最佳答案

您应该只对变量进行插值。我认为问题是您如何传递 :confirm 选项的结果。您可以通过将变量括在 #{} 中来将变量包含在引号内,如下所示:

<li class="dele-yaniv">
<%= link_to "delete", order, :method => :delete,
:confirm => "You sure you want to delete #{order.name}?",
:title => order.name %>
</li>

关于ruby-on-rails - :confirm is generating two confirm messages,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8845143/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com