ファイル
btrc-hub/backend/app/models/post_version.rb
T
2026-06-23 00:24:04 +09:00

24 行
601 B
Ruby

class PostVersion < ApplicationRecord
include VersionRecord
belongs_to :post
belongs_to :parent, class_name: 'Post', optional: true
validates :url, presence: true
validates :video_ms, numericality: { only_integer: true, greater_than: 0 }, allow_nil: true
validate :validate_original_created_range
private
def validate_original_created_range
f = original_created_from
b = original_created_before
return if f.blank? || b.blank?
if f >= b
errors.add :original_created_before, 'オリジナルの作成日時の順番がをかしぃです.'
end
end
end