So, I am trying to send a GET request from Postman and trying to run the method called question. I am also passing parameters in my request. I keep getting a routing error. Im not sure why. The way I am trying to route it is given below
Rails.application.routes.draw do
namespace 'api' do
namespace 'v1' do
get 'questions', to: 'application#/api/v1/question'
end
end
end
My questions_controller.rb has a method called question. The file is in app/controllers/api/v1/questions_controller.rb
The error I am getting, Picture of the error I am getting
EDIT. My QuestionController (Shortened version)
module Api
module V1
class QuestionsController < ApplicationController
def question
check_args = check_arguments(params[:lower], params[:upper])
if check_args.is_a?(String)
render html: "Error"
else
lower, upper = check_args
render json: create_question(lower, upper)
end
end
end
end
Aucun commentaire:
Enregistrer un commentaire