My rails api not returning desired value

9 views
Skip to first unread message

Yamazaki

unread,
Jun 7, 2016, 12:23:42 PM6/7/16
to Ruby on Rails: Talk

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"}
Reply all
Reply to author
Forward
0 new messages