blob: 429e7629936f2ad644654fed2151e88e965624b5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
module Pokeviewer
class Species < ApplicationRecord
extend Enumerize
has_many :pokemon, dependent: :restrict_with_exception
validates :name, presence: true, uniqueness: true
validates :type_1, presence: true
enumerize :type_1, in: Move::TYPES
enumerize :type_2, in: Move::TYPES
belongs_to :ability_1, class_name: "Ability"
belongs_to :ability_2, class_name: "Ability", optional: true
end
end
|