2013-05-04 92 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