你可以
添加一个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.您已经定义了一个包含以下链接的登录页面:<%= link_to“使用Facebook登录”,“/ auth / facebook”%>
另见RailsCasts tagged with authentication