6
잘 작동하는 게시 요청을 보내고 새 레코드를 만듭니다. 레코드가 생성 된 후에 그러나, 나는 서버 로그'create'작업을 성공적으로 실행 한 후 NoMethodError
NoMethodError (undefined method `device_url' for #<Api::V1::DevicesController:0x007fa2f5dde5d8>):app/controllers/api/v1/devices_controller.rb:14:in `create'
이
def create
respond_with Device.create(params[:device])
end
내 모든 자원이 API를 #의 V1에서 네임 스페이스있다가, 여기에 행동 만들 내 경로가
파일 내되어이 오류가 html로 POST 요청에 대한# Api ('/api')
namespace :api do
# Version 1 ('/api/v1')
namespace :v1 do
# Locations ('/api/v1/locations')
resources :locations
# Videos ('/api/v1/videos')
resources :videos
# Devices ('/api/v1/devices')
resources :devices
end
end
감사합니다. –
그것은 매력처럼 작동합니다! 고마워. –
작동합니다. 해결책에 대해 감사드립니다. 하지만 respond_with에서 리디렉션을 사용 중지하는 방법이 있습니까? API 요청 이후로 리디렉션 동작이 필요하지 않습니다. – lionel