新手问题 module 在 controller 上使用出现错误

hrz3424 · May 21, 2016 · Last by hrz3424 replied at May 22, 2016 · 1787 hits

TypeError in Admin::SessionsController#new Admin is not a module

module Admin class SessionsController < Devise::SessionsController before_filter :verify_rucaptcha!, only: :create

求教为啥会出现这个错误

SessionsController 在 admin 目录下没?

你是不是有个 class 叫 Admin

估计在 model 中有个 admin.rb 文件,用到了 class Admin。把 controller 中 module Admin 改为 class Admin 应该就正常了

#3 楼 @pathbox 哥们说对了,就是因为 model 有 admin class

You need to Sign in before reply, if you don't have an account, please Sign up first.