Sha256: f67c06adbe9dc4f36763ba854d9c4444d771df1a1ded1aa7134fcbc74733e4e9
Contents?: true
Size: 650 Bytes
Versions: 1
Compression:
Stored size: 650 Bytes
Contents
module Omnisocial class LoginAccount < ActiveRecord::Base belongs_to :user def self.find_or_create_from_auth_hash(auth_hash) if (account = find_by_remote_account_id(auth_hash['uid'])) account.assign_account_info(auth_hash) account.save account else create_from_auth_hash(auth_hash) end end def self.create_from_auth_hash(auth_hash) create do |account| account.assign_account_info(auth_hash) end end def find_or_create_user return self.user if self.user ::User.create do |user| user.login_account = self end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
elecnix-omnisocial-0.1.5 | app/models/omnisocial/login_account.rb |