Hi everyone. I'm newbe in ROR and recently faced with a routing problem. Here's my route:
post ':type/delete/:id' => 'todolist#delete_item', as: 'delete', constraints: {type: 'project|task'}
my link:
<%= link_to '', delete_path(type:'project',id: project.id),{class: 'glyphicon glyphicon-trash',data:{project_id: project.id},remote: true}%>
I get an error No route matches [GET] "/project/delete/158" WHY GET method???
routes: todolist_index GET /todolist/index(.:format) todolist#index sessions_new GET /sessions/new(.:format) sessions#new users_new GET /users/new(.:format) users#new log_out GET /log_out(.:format) sessions#destroy log_in GET /log_in(.:format) sessions#new sign_up GET /sign_up(.:format) users#new root GET / users#new users GET /users(.:format) users#index POST /users(.:format) users#create new_user GET /users/new(.:format) users#new edit_user GET /users/:id/edit(.:format) users#edit user GET /users/:id(.:format) users#show PATCH /users/:id(.:format) users#update PUT /users/:id(.:format) users#update DELETE /users/:id(.:format) users#destroy sessions GET /sessions(.:format) sessions#index POST /sessions(.:format) sessions#create new_session GET /sessions/new(.:format) sessions#new edit_session GET /sessions/:id/edit(.:format) sessions#edit session GET /sessions/:id(.:format) sessions#show PATCH /sessions/:id(.:format) sessions#update PUT /sessions/:id(.:format) sessions#update DELETE /sessions/:id(.:format) sessions#destroy todo GET /todo_list(.:format) todolist#index add_project POST /add_project(.:format) todolist#add_project edit_project POST /edit_project(.:format) todolist#edit_project POST /:add_task/:id(.:format) todolist#add_task delete POST /:type/:id(.:format) todolist#delete_item {:type=>"project|task"}