app/models/user/omni_auth_extension.rb
# Find user by omniauth uid for specified provider
# Or create new identity if user given
#
Find user by omniauth uid for specified provider
Or create new identity if user given
Find user by omniauth uid for specified provider Or create new identity if user given
def find_by_identity_for(provider, uid, current_user)
      identity = UserIdentity.find_by_provider_and_uid(provider, uid)
      return identity.user if identity
      if current_user
        current_user.identities.create!(:provider => provider, :uid => uid)
        return current_user
      end
      nil
    end
def find_by_identity_for ( provider , uid , current_user ) identity = UserIdentity . find_by_provider_and_uid ( provider , uid ) return identity . user if identity if current_user current_user . identities . create! ( :provider => provider , :uid => uid ) return current_user end nil end
Find user by omniauth uid for specified provider
Or create new identity if user given
Find user by omniauth uid for specified provider Or create new identity if user given
provider
uid
current_user