Module: Socialite::Models::UserConcern

Extended by:
ActiveSupport::Concern
Includes:
OmniAuth::Identity::Model, OmniAuth::Identity::SecurePassword
Defined in:
lib/socialite/models/user_concern.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args, &block) ⇒ Object


61
62
63
64
65
66
67
# File 'lib/socialite/models/user_concern.rb', line 61

def method_missing(id, *args, &block)
  if id =~ /(\w+)_identity$/ && @identity = self.identities.where(:provider => $1).first
    @identity
  else
    super
  end
end

Instance Method Details

#authorized?Boolean

Used for overloading the validations on username and email.

Returns:

  • (Boolean)

104
105
106
# File 'lib/socialite/models/user_concern.rb', line 104

def authorized?
  true
end

#facebookIdentity

Returns the first linked facebook identity

Returns:

  • (Identity)

    the first facebook identity


72
73
74
# File 'lib/socialite/models/user_concern.rb', line 72

def facebook
  self.facebook_identity
end

#twitterIdentity

Returns the first linked twitter account

Returns:

  • (Identity)

    the first twitter identity


79
80
81
# File 'lib/socialite/models/user_concern.rb', line 79

def twitter
  self.twitter_identity
end