2010-12-18 10 views

答えて

11

あなたはbefore_filterを追加することができます。

class ApplicationController < ActionController::Base 

    before_filter :authenticate 

    def authenticate 
    redirect_to :login unless User.find_by_provider_and_uid(auth["provider"], auth["uid"]) 
    end 
... 
end 

仮定: 1.あなたが好きなリンク(S)でログインページを定義している:<%= link_to "Sign in with Facebook", "/auth/facebook" %>

RailsCasts tagged with authentication

も参照してください。
関連する問題