You can not select more than 25 topics 
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long. 
		
		
		
		
		
			
	
	
		
			
	
		
			This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
		 
	
		
		
			
				
				
					
						
						
						
							# status:  
 
						
						
						
							# auth_type:  
 
						
						
						
							class  ApplyUserAuthentication  <  ApplicationRecord 
 
						
						
						
							  belongs_to  :user 
 
						
						
						
							
 
						
						
						
							  has_many  :tidings ,  :as  = >  :container ,  :dependent  = >  :destroy 
 
						
						
						
							  has_one  :attachment ,  as :  :container ,  dependent :  :destroy 
 
						
						
						
							
 
						
						
						
							  scope  :real_name_auth ,  - >  {  where ( auth_type :  1 )  } 
 
						
						
						
							  scope  :professional_auth ,  - >  {  where ( auth_type :  2 )  } 
 
						
						
						
							  scope  :processing ,  - >  {  where ( status :  0 )  } 
 
						
						
						
							  scope  :passed ,  - >  {  where ( status :  1 )  } 
 
						
						
						
							
 
						
						
						
							  after_create  :send_tiding 
 
						
						
						
							
 
						
						
						
							  def  status_text 
 
						
						
						
							    I18n . t! ( " apply_user_authentication.status. #{ status } " ) 
 
						
						
						
							  rescue  I18n :: MissingTranslationData 
 
						
						
						
							    nil 
 
						
						
						
							  end 
 
						
						
						
							
 
						
						
						
							  def  revoke! 
 
						
						
						
							    update! ( status :  3 ) 
 
						
						
						
							  end 
 
						
						
						
							
 
						
						
						
							  private 
 
						
						
						
							
 
						
						
						
							  def  send_tiding 
 
						
						
						
							    self . tidings  <<  Tiding . new ( :user_id  = >  '1' ,  :status = >  0 ,  :trigger_user_id  = >  user_id ,  :belong_container_id  = >  1 ,  :belong_container_type  = > 'User' ,  :tiding_type  = >  " Apply " ) 
 
						
						
						
							  end 
 
						
						
						
							end