Skip to content

Instantly share code, notes, and snippets.

@fukajun
Created June 25, 2012 11:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fukajun/2987962 to your computer and use it in GitHub Desktop.
Save fukajun/2987962 to your computer and use it in GitHub Desktop.
omniauthでのアクセス制限の設定
# 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