我想通过JSON进行新的用户注册,但是我收到了无效的真实性令牌错误.
我想不要为所有控制器打开伪造检查.有关如何覆盖registrationcontroller的任何建议吗?
这是我的代码:
class Api::MobileRegistrationsController < Devise::RegistrationsController
skip_before_filter :verify_authenticity_token
respond_to :json
def create
super
end
end
Run Code Online (Sandbox Code Playgroud)
路线:
Whitney::Application.routes.draw do
resources :apps
devise_for :users
namespace :api do
resources :tokens, :only => [:create, :destroy]
resources :MobileRegistrations, :only => [:create]
end
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
Routing Error
uninitialized constant Api::MobileRegistrationsController
Run Code Online (Sandbox Code Playgroud)