Class: ScavengerHunt::Hint

Inherits:
ApplicationRecord show all
Defined in:
lib/scavenger_hunt/app/models/scavenger_hunt/hint.rb

Constant Summary collapse

PENALTY =
30.seconds

Instance Method Summary collapse

Methods inherited from ApplicationRecord

hook, position_scope

Instance Method Details

#next_hintObject



17
18
19
20
# File 'lib/scavenger_hunt/app/models/scavenger_hunt/hint.rb', line 17

def next_hint
  return @next_hint if defined? @next_hint
  @next_hint = clue.hints.where("position > ?", position).first
end

#previous_hintObject



22
23
24
25
# File 'lib/scavenger_hunt/app/models/scavenger_hunt/hint.rb', line 22

def previous_hint
  return @previous_hint if defined? @previous_hint
  @previous_hint = clue.hints.where("position < ?", position).order(position: :desc).first
end