Ruby on rails RoutingError关于敲打的错误]
我使用的名称空间如下所示。当我访问http://localhost:3000/api/v1/user_token, 我遇到了这样的路由错误。我做错了什么 ActionController::RoutingError未初始化常量Api::V1::敲打: app/controllers/api/v1/user\u token\u controller.rb:3:in' app/controllers/api/v1/user\u token\u controller.rb:2:in' app/controllers/api/v1/user\u token\u controller.rb:1:in`' 这是我的密码。⬇︎ routes.rbRuby on rails RoutingError关于敲打的错误],ruby-on-rails,jwt,Ruby On Rails,Jwt,我使用的名称空间如下所示。当我访问http://localhost:3000/api/v1/user_token, 我遇到了这样的路由错误。我做错了什么 ActionController::RoutingError未初始化常量Api::V1::敲打: app/controllers/api/v1/user\u token\u controller.rb:3:in' app/controllers/api/v1/user\u token\u controller.rb:2:in' app/con
Rails.application.routes.draw do
namespace :api, format: 'json' do
namespace :v1, format: 'json' do
post 'user_token' => 'user_token#create'
end
end
end
用户\u令牌\u控制器.rb
module Api
module V1
class UserTokenController < Knock::AuthTokenController
end
end
end
class ApplicationController < ActionController::Base
include Knock::Authenticable
end
应用程序\u controller.rb
module Api
module V1
class UserTokenController < Knock::AuthTokenController
end
end
end
class ApplicationController < ActionController::Base
include Knock::Authenticable
end
::告诉Ruby在顶层查找敲门,而不是当前模块嵌套API::V1
有关详细说明,请参阅和。运行rake routes并共享..@Md.FarhanMemon这是一个Ruby常量查找错误。路线是不相关的,没错。我正在使用一个名为knock的gem进行身份验证。