summaryrefslogtreecommitdiff
path: root/app/models/equipment.rb
blob: ce3822cae27d946346d0b3ce2e336d9e627bd7ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Equipment < ApplicationRecord
  belongs_to :character
  belongs_to :item
  enum slot: [:mainhand, :offhand, :head, :neck, :back, :torso, :grip,
              :left_ring, :right_ring, :waist, :legs, :feet, :curio]
  validates :slot, presence: true, uniqueness: { scope: :character }

  def slot
    self[:slot].to_sym
  end

  def effects
    self.item.whatnot[:equip_effects]
  end
end