| 
				
			 | 
			
			
				@@ -11,6 +11,14 @@ class Person < ApplicationRecord 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				11
			 | 
			
			
				   before_validation :not_admin_if_nil 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				12
			 | 
			
			
				   before_save :update_user_email, if: :email_changed? 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				13
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				14
			 | 
			
			
				+  def full_name 
			 | 
		
	
		
			
			| 
				
			 | 
			
				15
			 | 
			
			
				+    if self.infix 
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+      [self.first_name, self.infix, self.last_name].join(' ') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+    else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+      [self.first_name, self.last_name].join(' ') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+    end 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+  end 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				22
			 | 
			
			
				   private 
			 | 
		
	
		
			
			| 
				15
			 | 
			
				23
			 | 
			
			
				   def birth_date_cannot_be_in_future 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				24
			 | 
			
			
				     if self.birth_date > Date.today 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -23,6 +31,8 @@ class Person < ApplicationRecord 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				31
			 | 
			
			
				   end 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				32
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				25
			 | 
			
				33
			 | 
			
			
				   def update_user_email 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				
			 | 
			
			
				-    self.user.update!(email: self.email) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+    if not self.user.nil? 
			 | 
		
	
		
			
			| 
				
			 | 
			
				35
			 | 
			
			
				+      self.user.update!(email: self.email) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+    end 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				37
			 | 
			
			
				   end 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				38
			 | 
			
			
				 end 
			 |