Html 如何在指定';方法';

Html 如何在指定';方法';,html,ruby-on-rails,ruby,Html,Ruby On Rails,Ruby,我正在尝试呈现以下html: <a href="<%= INSERT ARTICLE PATH WITH DELETE METHOD HERE %>" class="float-right action-button"> <button type="button" class="btn btn-light"> <%= image_tag("delete", size: "16x16") %> </button> <

我正在尝试呈现以下html:

<a href="<%= INSERT ARTICLE PATH WITH DELETE METHOD HERE %>" class="float-right action-button">
  <button type="button" class="btn btn-light">
    <%= image_tag("delete", size: "16x16") %>
  </button>
</a>
我想我的问题是我不知道如何使用“link_to xxx do”。 谢谢

更换这个

<%= link_to @article, method: :delete,, data: {confirm:'Are you sure?' }, class: "float-right action-button") do %>
  <button type="button" class="btn btn-light">
    <%= image_tag("delete", size: "16x16") %>
  </button>
<%= end %>

用这个

<%= link_to @article, method: :delete, data: {confirm:'Are you sure?' }, class: "float-right action-button" do %>
  <button type="button" class="btn btn-light">
    <%= image_tag("delete", size: "16x16") %>
  </button>
<% end %>

您不需要添加for
end
。请告诉我错误是否已解决。
请检查指向的链接。

请提供错误信息get@Vishal我添加了"Mikhail Katrin"我如何在链接中指定它?@Article.index?像这样
谢谢你的回复:我复制粘贴了代码,我得到了一个语法错误:请向上投票我的答案。如果对您有帮助:)。这对其他用户也有帮助。更新了我的答案,请复制粘贴。它成功了,你在最后添加了一个错误的“'),可能会为了帮助他人而更改它!此外,我无法以我目前的声誉投票支持您的答案:(抱歉!更正了我的答案。您可以投票支持您的答案,因为您发布了questoin。您也可以接受答案。
<%= link_to @article, method: :delete,, data: {confirm:'Are you sure?' }, class: "float-right action-button") do %>
  <button type="button" class="btn btn-light">
    <%= image_tag("delete", size: "16x16") %>
  </button>
<%= end %>
<%= link_to @article, method: :delete, data: {confirm:'Are you sure?' }, class: "float-right action-button" do %>
  <button type="button" class="btn btn-light">
    <%= image_tag("delete", size: "16x16") %>
  </button>
<% end %>