在我看来,我有 2 个链接:一个用于编辑,效果很好,一个用于销毁操作。
方法看起来像:
def create_ticket(ticket)
@ticket = ticket
@edit = edit_ticket_url(@ticket, :host => "localhost:3000", :guest_password => @ticket.guest_password)
@destroy = ticket_url(@ticket, :host => "localhost:3000", :guest_password => @ticket.guest_password)
mail(:to => @ticket.email, :subject => @ticket.subject)
结尾
在视图模板中:
<%= link_to "Edit Ticket", @edit %>
<%= link_to "Delete Ticket", @destroy, :method => :delete %>
最后一个只是获取路径而不是破坏项目。
如何解决这个问题?