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
|
||||
|
@@ -24,5 +24,4 @@ class Puzzle < ApplicationRecord
|
||||
has_one_attached :image
|
||||
|
||||
validates :name, presence: true
|
||||
validates :brand, presence: true
|
||||
end
|
||||
|
Reference in New Issue
Block a user