class ApplicationController < ActionController::Base
protect_from_forgery
skip_before_filter :authenticate_user! , :only => ["welcome#index"]
# before_filter :authenticate_user! :except => ["welocme#index"]
def after_sign_in_path_for(user)
# user_dashboard_index_path
user_dashboard_index_path
end
def after_sign_out_path_for(user)
welcome_index_path
end
after_filter :authenticate_admin!
def after_sign_in_path_for(admin)
admin_dashboard_index_path
end
def after_sign_out_path_for(admin)
welcome_index_path
end
end
管理員不應訪問用戶儀表板,同樣,用戶不應訪問管理儀表板。分別對用戶和管理員進行身份驗證
我該如何做到這一點?
你是如何設置你的設計?你有沒有遇到任何障礙?設計維基有關於如何實現這樣的信息。 authenticate_ * before_filters應該可以幫助您限制訪問。如果沒有發生,那麼請發佈相關的設備設置代碼。 –