По каким-то пока не понятным причинам facebook отвечает оочень медленно:
cl.ly/Gou0.
Я использую OmniAuth, код выглядит так:
class AuthenticationsController < ApplicationController
...
def create
auth = auth_hash
if current_user
# If logged in, then try to add an authentication
current_user.authentications.find_or_create_by_provider_and_uid_and_auth_token(auth['provider'], auth['uid'], auth['credentials']['token'])
else
# If not logged in, check, if has been logged in earlier
authentication = Authentication.find_by_provider_and_uid(auth['provider'], auth['uid'])
if authentication.nil?
# If not, create User
u = User.create_with_omniauth(auth)
u.authentications.create!(provider: auth['provider'], uid: auth['uid'], auth_token: auth['credentials']['token'])
else
# Else log in with existing user
u = User.find(authentication.user_id)
end
session[:user_id] = u.id
dependent_respond
end
end
end
Где я неправ?