Gokul595 / api_guard

JWT authentication solution for Rails APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when use nested routes like /api/v1/api_guard

JacquesMarques opened this issue · comments

Hi,
I try to use this gem with this route setup:

`
Rails.application.routes.draw do

Rails.application.routes.draw do

namespace :api do

  namespace :v1 do

    api_guard_routes for: 'users'

But when I try to use any resource I get this error:

<ActionController::RoutingError: uninitialized constant Api::V1::ApiGuard. Object.const_get(camel_cased_word). raise MissingController.new(error.message, error.name)

How can I do to use with gem this nested routes?

Thanks,

jacquesMarques, you cannot namespace it like that, you need to scope it

scope path: "api" do
scope path: "v1" do
api_guard_routes for: 'users'
end
end

Thanks @hassanrbh for the reply. Closing this due to inactivity.

@JacquesMarques Feel free to reopen if you are still facing this issue.