0

我无法从数据库中删除记录。我不断收到此错误。

PG::Error: ERROR: zero-length delimited identifier at or near """" LINE 1: ...ctive_items" WHERE "users_items"."" = $1 ^ : DELETE FROM "users_items" WHERE "users_items"."" = $1

这是方法。

def delete_items
    @destroyer = UsersItems.find_by_item_id(params[:items_id])
    @destroyer.destroy
    flash[:notice] = "Item deleted"
    redirect_to itemsearch_path

结尾

<a><%= link_to "Delete Item",{:controller => "items", :action => "delete_items",:method => :delete,:item_id => item.id}%></a>
4

1 回答 1

1

改变这个:

<a><%= link_to "Delete Item",{:controller => "items", :action => "delete_items",:method => :delete,:item_id => item.id}%></a>

为了这:

<%= link_to "Delete Item",{:controller => "items", :action => "delete_items", :item_id => item.id}, :method => :delete%>
于 2013-07-02T19:53:52.833 回答