出處:https://github.com/plataformatec/devise/wiki/OmniAuth%3a-Overview
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def facebook
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.find_for_facebook_oauth(request.env["omniauth.auth"], current_user)
....
end
end
def self.find_for_facebook_oauth(auth, signed_in_resource=nil)
user = User.where(:provider => auth.provider, :uid => auth.uid).first
unless user
user = User.create(name:auth.extra.raw_info.name,
provider:auth.provider,
uid:auth.uid,
email:auth.info.email,
password:Devise.friendly_token[0,20]
)
end
user
end
請問他這樣設計的用意是什麼? find_for_facebook_oauth 參數傳 current_user 進去 但是 find_for_facebook_oauth 這個方法裡面完全沒用到這個傳進去的參數