diff options
author | Job van der Voort <jobvandervoort@gmail.com> | 2015-04-21 17:21:51 +0300 |
---|---|---|
committer | Job van der Voort <jobvandervoort@gmail.com> | 2015-04-21 17:21:51 +0300 |
commit | a8e93b7f51d968c1380ed210499869b62b07fd15 (patch) | |
tree | c864e80dfd9cf4f83fcede678acc986e3a125bf5 /app/models/email.rb | |
parent | 0625b15a481b3a3edd88110b3c18031ad9068d2f (diff) |
Version 7.10.0.rc5v7.10.0.rc5
Diffstat (limited to 'app/models/email.rb')
-rw-r--r-- | app/models/email.rb | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/app/models/email.rb b/app/models/email.rb deleted file mode 100644 index 556b0e9586e..00000000000 --- a/app/models/email.rb +++ /dev/null @@ -1,35 +0,0 @@ -# == Schema Information -# -# Table name: emails -# -# id :integer not null, primary key -# user_id :integer not null -# email :string(255) not null -# created_at :datetime -# updated_at :datetime -# - -class Email < ActiveRecord::Base - include Sortable - - belongs_to :user - - validates :user_id, presence: true - validates :email, presence: true, email: { strict_mode: true }, uniqueness: true - validate :unique_email, if: ->(email) { email.email_changed? } - - after_create :notify - before_validation :cleanup_email - - def cleanup_email - self.email = self.email.downcase.strip - end - - def unique_email - self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email) - end - - def notify - NotificationService.new.new_email(self) - end -end |