0
私は、エラーが原因で関連のいくつかの並べ替えである知っているこのアクティブレコードと、ArgumentError破壊(1を与えられた引数(の間違った番号を、)0を予想):
def destroy
@purchase=current_user.purchases.where(flooding_property_id: params[:id])
@purchase.destroy(flooding_property_id: params[:id])
end
などの購入のオブジェクトを破壊しようとしていますI持っているが、私はそれを把握していないようだ。
create_table "flooding_properties", force: :cascade do |t|
t.string "address"
t.string "zipcode"
t.geography "latlon", limit: {:srid=>4326, :type=>"point", :geographic=>true}
t.datetime "last_updated"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "flooding_properties", ["latlon"], name: "index_flooding_properties_on_latlon", using: :gist
add_index "flooding_properties", ["zipcode"], name: "index_flooding_properties_on_zipcode", using: :btree
create_table "purchases", force: :cascade do |t|
t.boolean "billed", default: false
t.integer "user_id"
t.integer "flooding_property_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "purchases", ["billed"], name: "index_purchases_on_billed", where: "(billed = false)", using: :btree
add_index "purchases", ["flooding_property_id"], name: "index_purchases_on_flooding_property_id", using: :btree
add_index "purchases", ["user_id"], name: "index_purchases_on_user_id", using: :btree
create_table "users", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "first_name"
t.string "last_name"
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
end
うわー、それを解決します。どうもありがとうございます!もともとは問題だと思っていましたが、@ purchase.first.destroy(flooding_property_id:params [:id])を試しましたが、うまくいきませんでした。 – beewuu
これは素晴らしいことです。私の答えに印を付けることができますか? –