Sha256: cd86e7d10cf5227b49bf49087d6eabda870b2a169a844b50b38346f5c87ea2b3
Contents?: true
Size: 941 Bytes
Versions: 1
Compression:
Stored size: 941 Bytes
Contents
module Omnisocial class User < ActiveRecord::Base self.abstract_class = true has_one :login_account, :class_name => 'Omnisocial::LoginAccount', :dependent => :destroy delegate :login, :name, :picture_url, :account_url, :access_token, :to => :login_account def to_param if !self.login.include?('profile.php?') "#{self.id}-#{self.login.gsub('.', '-')}" else self.id.to_s end end def from_twitter? login_account.kind_of? TwitterAccount end def from_facebook? login_account.kind_of? FacebookAccount end def from_linked_in? login_account.kind_of? LinkedInAccount end def remember update_attributes(:remember_token => ::BCrypt::Password.create("#{Time.now}-#{self.login_account.type}-#{self.login}")) unless new_record? end def forget update_attributes(:remember_token => nil) unless new_record? end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
elecnix-omnisocial-0.1.5 | app/models/omnisocial/user.rb |