Remove EmailsObserver
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
		
							parent
							
								
									3faa14e7a7
								
							
						
					
					
						commit
						599344583b
					
				|  | @ -21,6 +21,7 @@ class Email < ActiveRecord::Base | |||
|   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 | ||||
|  | @ -30,4 +31,8 @@ class Email < ActiveRecord::Base | |||
|   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 | ||||
|  | @ -1,5 +0,0 @@ | |||
| class EmailObserver < BaseObserver | ||||
|   def after_create(email) | ||||
|     notification.new_email(email) | ||||
|   end | ||||
| end | ||||
		Loading…
	
		Reference in New Issue