안녕 원하는 값을 반환하지,하지만 난 "안녕하세요"내 레일 API를 내가 API를 쓰기 위해 노력하고있어
컨트롤러 반환하지 않는 컨트롤러에 문제가 있어요 :
class ApisController < ApplicationController
before_action :set_api, only: [:show, :edit, :update, :destroy]
# GET /apis
# GET /apis.json
def alertdump
respond_to do |format|
format.html { render html: 'hi' }
format.json { render json: "hi" }
end
end
경로를 :
resources :apis do
collection do
post 'alertdump/:fullalert', :action=> 'alertdump'
end
end
내가 대신지고있어이
{"id":1,"created_at":"2016-06-07T15:05:17.897Z","updated_at":"2016-06-07T15:05:17.897Z"}
(모델 'API'의 첫 번째 요소 인)
어떤 요청을 사용하고 경로를 어떻게 정의합니까? –