在我的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