Sha256: 3bd644bdf75a539ef2b4d07a2f9c8e6800baeb63124b1cf2cc0ed0ce486725b3

Contents?: true

Size: 297 Bytes

Versions: 6

Compression:

Stored size: 297 Bytes

Contents

class SocialAccount < ActiveRecord::Base

  belongs_to :user

  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

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.5 app/models/social_account.rb
iugusdk-1.0.0.alpha.4 app/models/social_account.rb
iugusdk-1.0.0.alpha.3 app/models/social_account.rb
iugusdk-1.0.0.alpha.2 app/models/social_account.rb
iugusdk-1.0.0.alpha.1 app/models/social_account.rb
iugusdk-1.0.0.alpha.0 app/models/social_account.rb