ぼざクリタグ広場 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.
 
 
 
 
 
 

22 lines
478 B

  1. class Deerjikist < ApplicationRecord
  2. self.primary_key = :platform, :code
  3. belongs_to :tag
  4. validates :platform, presence: true
  5. validates :code, presence: true
  6. validates :tag_id, presence: true
  7. validate :tag_must_be_deerjikist
  8. enum :platform, nico: 'nico', youtube: 'youtube'
  9. private
  10. def tag_must_be_deerjikist
  11. if tag && !(tag.deerjikist?)
  12. errors.add :tag, 'タグはニジラー・カテゴリである必要があります.'
  13. end
  14. end
  15. end