Class: Email

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Sortable
Defined in:
app/models/email.rb

Overview

Schema Information

Table name: emails

id         :integer          not null, primary key
user_id    :integer          not null
email      :string           not null
created_at :datetime
updated_at :datetime

Instance Method Summary collapse

Instance Method Details

#cleanup_emailObject


23
24
25
# File 'app/models/email.rb', line 23

def cleanup_email
  self.email = self.email.downcase.strip
end

#unique_emailObject


27
28
29
# File 'app/models/email.rb', line 27

def unique_email
  self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email)
end