Sha256: 627b696dd91bf323781d75100de776bc09c73c69b53d5884b6b91f033b53e66f

Contents?: true

Size: 509 Bytes

Versions: 4

Compression:

Stored size: 509 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
  
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cornflakeomnisocial-0.1.2.7 app/models/omnisocial/login_account.rb
cornflakeomnisocial-0.1.2.6 app/models/omnisocial/login_account.rb
cornflakeomnisocial-0.1.2.5 app/models/omnisocial/login_account.rb
cornflakeomnisocial-0.1.2.4 app/models/omnisocial/login_account.rb