added delete

parent e01cb97a
......@@ -17,4 +17,10 @@ class CarLogsController < ApplicationController
x.save
redirect_to "/carlogs"
end
def delete
id = params[:id]
@car = CarLog.find(id.to_i)
@car.destroy
redirect_to "/carlogs"
end
end
\ No newline at end of file
......@@ -4,7 +4,7 @@ Rails.application.routes.draw do
get "/group", to: "pages#group"
get "/carlogs/new", to: "car_logs#form"
post "/carlogs/create", to: "car_logs#create"
get "carlogs/delete/:id", to: "car_logs#delete"
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment