class Pokemon < ApplicationRecord has_many :pokedex_entries, dependent: :restrict_with_error validates :pokedex_num, :name, presence: true def sprite_path(shiny: false) "sprites/pokemon/#{"shiny/" if shiny}#{pokedex_num}.png" end end