在我的rails应用程序中,我使用devise
进行身份验证,我的模型名称为user
,对此,我有一个布尔字段admin
。在我的routes.rb
中,我试图限制除管理员以外的所有用户访问网址。只允许管理员用户访问一个resque web界面
mount Resque::Server.new, :at => "/resque"
。我试着用色器件的CURRENT_USER帮手像
mount Resque::Server.new, :at => "/resque" if current_user.admin == true
但是得到了错误undefined local variable or method 'current_user' for #<ActionDispatch::Routing::Mapper:0x000000053ac780> (NameError)
。这个怎么做?我是新来的导轨请帮助
你的路由不知道什么工作会话或登录用户。 – Alfie