我有以下代码:
class Admin::ApplicationController < ApplicationController
include Admin::AuthHelper
before_filter :authorize
layout 'admin/application'
protected
def authorize
if controller_name != 'Auth' && action_name != 'login'
if is_authenticated_admin!
redirect_to :admin_login, :flash => { warning: t(:unauthorized) }
end
end
end
end
是否可以更换:
if controller_name != 'Auth' && action_name != 'login'
只需检查该路线是否不是命名路线:admin_login?我正在使用 Rails 4.0.1。