Assuming a PORO such as:
class Player
include ActiveModel::Model
include ActiveModel::Validations
attr_accessor :name, :position
validates :name, :position
VALID_POSITIONS = ['goalie', 'defense', 'forward']
validates :position, :inclusion { in: VALID_POSITIONS}
BENCH_WARMER = Player.new(name: "Biz", position: "bench_warmer")
end
How is
BENCH_WARMERable to supersede the validation explicitly stated for thepositionattribute?And what does this instantiation within itself of
BENCH_WARMERafford the application/What can I do withBENCH_WARMERnow that it exists within this class?Why validate if it's simply going to be ignored in the next line?
Googling this sort of question points to a bunch of rudimentary resources about using self and how to create instances of an object outside of itself.