Multiples traductions
This commit is contained in:
@@ -23,14 +23,16 @@ class Contestant < ApplicationRecord
|
||||
belongs_to :contest
|
||||
has_many :completions, dependent: :destroy
|
||||
|
||||
before_create :initialize_time_seconds
|
||||
before_validation :initialize_time_seconds_if_empty
|
||||
|
||||
validates :name, presence: true
|
||||
validates :time_seconds, presence: true
|
||||
|
||||
private
|
||||
|
||||
def initialize_time_seconds
|
||||
self.time_seconds = 0
|
||||
def initialize_time_seconds_if_empty
|
||||
if !self.time_seconds
|
||||
self.time_seconds = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user