以下是默认脚手架生成的内容:
<%= link_to 'Delete', admin_user, method: :delete, data: { confirm: 'Are you sure you want to delete?' } %>
我想创建一个辅助方法,以便我可以调用 aremove_link(admin_user)
并让它的行为方式相同:
def remove_link(item)
link_to item, method: :delete, :data { confirm: 'Esta seguro que quiere eliminar este registro?' } do
"#{content_tag :i, nil, class: 'icon-remove-sign'}".html_safe
end
end
但我收到了这个错误:
Admin::UsersController#index 中的语法错误
/home/sergio/Work/foo/app/helpers/application_helper.rb:11: syntax error, unexpected '{', expecting tASSOC
... item, method: :delete, :data { confirm: 'Esta seguro que qu...