Add offline model and "new" form/controller
This commit is contained in:
		| @@ -31,6 +31,7 @@ class Contest < ApplicationRecord | ||||
|   has_many :contestants, dependent: :destroy | ||||
|   has_many :puzzles, dependent: :destroy | ||||
|   has_many :messages, dependent: :destroy | ||||
|   has_many :offlines, dependent: :destroy | ||||
|  | ||||
|   friendly_id :name, use: :slugged | ||||
|  | ||||
|   | ||||
							
								
								
									
										27
									
								
								app/models/offline.rb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								app/models/offline.rb
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| # == Schema Information | ||||
| # | ||||
| # Table name: offlines | ||||
| # | ||||
| #  id         :integer          not null, primary key | ||||
| #  end_time   :datetime | ||||
| #  start_time :datetime         not null | ||||
| #  created_at :datetime         not null | ||||
| #  updated_at :datetime         not null | ||||
| #  contest_id :integer          not null | ||||
| # | ||||
| # Indexes | ||||
| # | ||||
| #  index_offlines_on_contest_id  (contest_id) | ||||
| # | ||||
| # Foreign Keys | ||||
| # | ||||
| #  contest_id  (contest_id => contests.id) | ||||
| # | ||||
| class Offline < ApplicationRecord | ||||
|   belongs_to :contest | ||||
|  | ||||
|   has_one_attached :start_image | ||||
|   has_one_attached :end_image | ||||
|  | ||||
|   validates :start_time, presence: true | ||||
| end | ||||
		Reference in New Issue
	
	Block a user