Class: Omnisocial::User
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Omnisocial::User
- Defined in:
- app/models/omnisocial/user.rb
Direct Known Subclasses
Instance Method Summary collapse
- #facebook_account ⇒ Object
- #forget ⇒ Object
- #from_facebook? ⇒ Boolean
- #from_twitter? ⇒ Boolean
- #remember ⇒ Object
- #twitter_account ⇒ Object
Instance Method Details
#facebook_account ⇒ Object
6 7 8 |
# File 'app/models/omnisocial/user.rb', line 6 def facebook_account login_accounts.select{|account| account.kind_of? FacebookAccount}.first end |
#forget ⇒ Object
26 27 28 |
# File 'app/models/omnisocial/user.rb', line 26 def forget update_attributes(:remember_token => nil) unless new_record? end |
#from_facebook? ⇒ Boolean
10 11 12 |
# File 'app/models/omnisocial/user.rb', line 10 def from_facebook? !!facebook_account end |
#from_twitter? ⇒ Boolean
14 15 16 |
# File 'app/models/omnisocial/user.rb', line 14 def from_twitter? !!twitter_account end |
#remember ⇒ Object
22 23 24 |
# File 'app/models/omnisocial/user.rb', line 22 def remember update_attributes(:remember_token => ::BCrypt::Password.create("#{Time.now}-#{self.login_accounts.first.type}-#{self.login_accounts.first.login}")) unless new_record? end |
#twitter_account ⇒ Object
18 19 20 |
# File 'app/models/omnisocial/user.rb', line 18 def twitter_account login_accounts.select{|account| account.kind_of? TwitterAccount}.first end |