Created
June 25, 2012 11:02
-
-
Save fukajun/2987962 to your computer and use it in GitHub Desktop.
omniauthでのアクセス制限の設定
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# application_controller.rbに定義 | |
def authenticate | |
redirect_to :root unless current_user | |
end | |
# 認証の必要なコントローラーの最初の行にbefore_filterを定義 | |
class HogeController | |
before_filter authenticate # ←コレ | |
class HogeController | |
before_filter authenticate :only => [:index, :show] # indexとshowのみ認証必要 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment