Hi I’m trying to write an api, but I’m having an issue with the
controller
not returning “hi”
Controller:
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
Routes:
resources :apis do
collection do
post ‘alertdump/:fullalert’, :action=> ‘alertdump’
end
end
I’m getting instead this (which is the first element of the model ‘api’)
{“id”:1,“created_at”:“2016-06-07T15:05:17.897Z”,“updated_at”:“2016-06-07T15:05:17.897Z”}