lundi 10 août 2015

How to route the same verb to different actions on a resource?

I have a task_list model that has some actions like archive and destroy. I want to route them like this:

resources :task_lists, only: [:create, :update] do
    member do
      delete '' => 'task_lists#archive'
      delete 'destroy' => 'task_lists#destroy'
    end
end

but rake routes gives same route for both of them.

             DELETE   /api/0.0/task_lists/:id(.:format)    task_lists#archive {:format=>:json}
   task_list DELETE   /api/0.0/task_lists/:id(.:format)    task_lists#destroy {:format=>:json}

so what can I do?

Thanks!

Aucun commentaire:

Enregistrer un commentaire