0
단일 사용자 분류에 대해 before_filter를 사용하는 방법에 대해 잘 설명되어 있으므로 여러 사용자 유형에 대한 작업 수준 보호를 얻는 데 문제가 있습니다. 설명해 드리죠 : 나는 이런 식으로 뭔가있어Authlogic 및 STI를 사용하여 활동 레벨 보호를 얻는 방법은 무엇입니까?
을 ...
class ApplicationController < ActionController::Base
class << self
attr_accessor :standard_actions
end
@standard_actions = [:index, :show, :new, :edit, :create, :update, :destroy]
def require_guardian
unless current_user and current_user.is_a?(Guardian)
store_location
redirect_to home_url
return false
end
end
def require_admin
unless current_user and current_user.is_a?(Administrator)
store_location
redirect_to register_url
return false
end
end
end
그리고 난 단지 표준 관리자의 작업을하지만 다른 모든 행동은 보호자를 필요로한다을 허용 할 GuardiansController에서
. 그래서 이것을 시도 ...결국 재귀 적 리다이렉션이 끝납니다. 더 좋은 방법이있을거야?