I am having an problem routing to my delete method on my restful web service for permissions. My routes are set up as follows :
namespace :service do
namespace :v1 do
resources :surveys do
resources :permissions, only: [:index, :create, :delete, :update]
end
end
end
The following spec passes
it "routes toya expected controller method" do
{:get => 'service/v1/surveys/3/permissions'}.should route_to(controller: 'service/v1/permissions', action: 'index', :survey_id => "3")
end
This spec fails
describe 'DELETE :destroy' do
it "routes to expected controller method" do
{:delete => 'service/v1/surveys/3/permissions'}.should route_to(controller: 'service/v1/permissions', action: 'destroy', :survey_id => "3")
end
end
The snippet from my controller is as follows
module Service
module V1
class PermissionsController < ApplicationController
before_filter :authenticate_user!, :only => []
def index
render :json => permissions, :each_serializer => Service::V1::PermissionSerializer
end
def destroy
debugger
# cant route to here
a = 1
end
end
end
end
Any suggestions ? I am slightly confused between destroy and delete, I think that might be the source of my problem
Aucun commentaire:
Enregistrer un commentaire