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 に答える