2023-12-29 12:16:30 +00:00
|
|
|
class DiaryEntry < ApplicationRecord
|
|
|
|
belongs_to :user
|
2023-12-29 12:17:57 +00:00
|
|
|
has_many :exercises
|
2023-12-29 12:16:30 +00:00
|
|
|
|
|
|
|
validates :date,
|
|
|
|
:pain_level,
|
|
|
|
:energy_level,
|
|
|
|
:mental_alertness_level,
|
|
|
|
:work_stress_level,
|
|
|
|
:life_stress_level,
|
2023-12-29 14:27:09 +00:00
|
|
|
:sleep_quality_level,
|
2023-12-31 11:33:04 +00:00
|
|
|
:weight,
|
2023-12-29 12:16:30 +00:00
|
|
|
presence: true
|
2023-12-31 11:33:04 +00:00
|
|
|
|
|
|
|
validates :pain_level,
|
|
|
|
:energy_level,
|
|
|
|
:mental_alertness_level,
|
|
|
|
:work_stress_level,
|
|
|
|
:life_stress_level,
|
|
|
|
:sleep_quality_level,
|
|
|
|
numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 10 }
|
|
|
|
|
|
|
|
validates :weight, numericality: { greater_than_or_equal_to: 0 }
|
2023-12-29 12:16:30 +00:00
|
|
|
end
|