ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

23 lines
507 B

  1. class PostVersion < ApplicationRecord
  2. include VersionRecord
  3. belongs_to :post
  4. belongs_to :parent, class_name: 'Post', optional: true
  5. validates :url, presence: true
  6. validate :validate_original_created_range
  7. private
  8. def validate_original_created_range
  9. f = original_created_from
  10. b = original_created_before
  11. return if f.blank? || b.blank?
  12. if f >= b
  13. errors.add :original_created_before, 'オリジナルの作成日時の順番がをかしぃです.'
  14. end
  15. end
  16. end