0
Rails-Api (4)를 사용하고 있으며 네임 스페이스가 지정된 라우트 파일에 대해 세 개의 경로 만 필요합니다. 내 routes.rb 파일에서 Rails-Api (4) : Namespaced routes, only : actions
, 나는이 작업을 수행하려고 :namespace :api do
namespace :v1 do
resources :documents, only: [:get, :create]
resource :system_status, only: [:get]
end
end
rake routes
저를 가져옵니다 만이 : 오프하여 only:
을 경우
Prefix Verb URI Pattern Controller#Action
api_v1_documents POST /api/v1/documents(.:format) api/v1/documents#create
, 작동 및 제공 나에게 모든 길 (나는 그것을 원하지 않는다).
namespace :api do
namespace :v1 do
post '/documents', to: 'documents#create'
get '/documents/:id', to: 'documents#show'
get '/system_status', to: 'system_status#show'
end
end
rake routes
나에게이 이상한 결과를 가져옵니다 :
Prefix Verb URI Pattern Controller#Action
api_v1_documents POST /api/v1/documents(.:format) api/v1/documents#create
api_v1 GET /api/v1/documents/:id(.:format) api/v1/documents#show
api_v1_system_status GET /api/v1/system_status(.:format) api/v1/system_status#show
는 접두사의로 documents#show
나에게 유일한 api_v1
을 받고 함께 무슨 일이야 확실하지.
하! 네. 피곤한 두뇌. 감사! –
@MichaelH. 우리 한테 일어난 일. 행운을 빕니다! (또한 가능한 경우 답변을 수락하는 것을 잊지 마십시오) –