Class: SocialAccount

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
ActiveUUID::UUID
Defined in:
app/models/social_account.rb

Instance Method Summary collapse

Methods included from ActiveUUID::UUID

#fix_uuid_strings, included

Instance Method Details



6
7
8
9
10
11
12
13
# File 'app/models/social_account.rb', line 6

def unlink
  if self.user.social_accounts.count == 1 && (self.user.email.blank? || self.user.encrypted_password.blank?)
    errors.add(:base, "only_social_and_no_email")
    false
  else
    self.destroy
  end
end