我有以下格式的link_to
Rails标记:
<%= link_to 'Delete', somePath,
method: :delete, confirm: "Are you sure you want to delete this?",
class: "delete" %>
我一直在尝试添加do
块来在生成的锚标记中添加一些任意内容块。我尝试了以下,但无济于事:
<%= link_to '<content>Delete' ... %>
# Which yields => <content>Delete in the DOM as a string instead of HTML
和
<%= link_to 'Delete' ... class: "delete" do %>
<content>
<% end %>
抛出错误undefined method 'stringify_keys'
。有什么想法吗?
答案 0 :(得分:0)
尝试:
<%= link_to url_path ... class: "delete" do %>
Delete <content>
<% end %>