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.
		
		
		
		
		
			
		
			
				
					
					
						
							18 lines
						
					
					
						
							538 B
						
					
					
				
			
		
		
	
	
							18 lines
						
					
					
						
							538 B
						
					
					
				| class Inform < ApplicationRecord
 | |
|   belongs_to :container, polymorphic: true, optional: true
 | |
| 
 | |
|   validates :name, length: { maximum: 60 }
 | |
|   validates :description, length: { maximum: 5000 }
 | |
| 
 | |
|   has_many :attachments, as: :container, dependent: :destroy
 | |
| 
 | |
|   def next_inform
 | |
|     Inform.find_by(position: self.position+1, container_id: self.container_id, container_type: self.container_type)
 | |
|   end
 | |
| 
 | |
|   def  last_inform
 | |
|     Inform.find_by(position: self.position-1, container_id: self.container_id, container_type: self.container_type)
 | |
|   end
 | |
| 
 | |
| end
 |