2013-05-04 90 views

回答

0

文档已经解释了,你必须做的:

在你rails_admin.rb初始化:

config.authenticate_with do 
    warden.authenticate! :scope => :admin 
end 
config.current_user_method { current_admin } # hook to your 'current_user' method 

而用户模式你生成current_admin方法:

def current_admin 
    current_user && current_user.is_admin 
end 

我认为这应该工作。

+0

Mattherick请问这个warden.authenticate! :scope =>:admin是什么意思? – 2013-05-04 13:01:02

+0

也许这回答你的问题:https://github.com/hassox/warden/wiki/Scopes。你可以配置你的rails_admin来使用warden认证。 – Mattherick 2013-05-04 13:13:26