class User < ApplicationRecord # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable devise :database_authenticatable, :rememberable has_many :checkpoints, through: :runs has_many :pokedex_entries, dependent: :destroy has_many :runs, dependent: :restrict_with_error def pokedex_captured_count pokedex_entries.joins(:pokemon).select("distinct pokemons.pokedex_num").count end end