|  |  |  | @ -7,6 +7,7 @@ | 
			
		
	
		
			
				
					|  |  |  |  | class Game < ApplicationRecord | 
			
		
	
		
			
				
					|  |  |  |  |   default_scope { order("games.created_at desc") } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |   #TODO: games表要增加challenge_id与user_id的唯一索引 | 
			
		
	
		
			
				
					|  |  |  |  |   has_many :outputs, -> { order('query_index DESC') } | 
			
		
	
		
			
				
					|  |  |  |  |   has_many :challenge_samples, :dependent => :destroy | 
			
		
	
		
			
				
					|  |  |  |  |   has_many :game_codes, :dependent => :destroy | 
			
		
	
	
		
			
				
					|  |  |  | 
 |