Class: Improvements::AdvancedMove

Inherits:
Improvement show all
Defined in:
app/models/improvements/advanced_move.rb

Overview

This is for Improvements like “Mark two of the basic moves as advanced”

Constant Summary

Constants inherited from Improvement

Improvement::IMPROVEMENT_TYPES

Instance Attribute Summary

Attributes inherited from Improvement

#advanced, #created_at, #description, #id, #playbook_id, #rating, #stat_limit, #type, #updated_at

Instance Method Summary collapse

Methods inherited from Improvement

advanced_eligible?, policy_class

Methods inherited from ApplicationRecord

policy_class

Instance Method Details

#improvable_options(hunter) ⇒ Object


37
38
39
40
41
42
43
44
# File 'app/models/improvements/advanced_move.rb', line 37

def improvable_options(hunter)
  moves = Moves::Basic
          .joins("LEFT JOIN hunters_moves ON \
            moves.id = hunters_moves.move_id AND hunter_id = #{hunter.id}")
          .where(hunters_moves: { advanced: [false, nil] })
          .select(:'moves.id', :name, :description)
  { moves: { data: moves, count: 2 } }
end