Try to avoid any potential loops
This commit is contained in:
		
							parent
							
								
									86264a950c
								
							
						
					
					
						commit
						788e884690
					
				
					 1 changed files with 3 additions and 7 deletions
				
			
		|  | @ -125,13 +125,9 @@ class Account < ApplicationRecord | |||
| 
 | ||||
|   def save_with_optional_avatar! | ||||
|     save! | ||||
|   rescue ActiveRecord::RecordInvalid => invalid | ||||
|     if invalid.record.errors[:avatar_file_size] || invalid.record.errors[:avatar_content_type] | ||||
|       self.avatar = nil | ||||
|       retry | ||||
|     end | ||||
| 
 | ||||
|     raise invalid | ||||
|   rescue ActiveRecord::RecordInvalid | ||||
|     self.avatar = nil | ||||
|     save! | ||||
|   end | ||||
| 
 | ||||
|   def avatar_remote_url=(url) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue