From 10599ab2e789ffb93a19f6aa3c100f533c460315 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sun, 29 Oct 2023 11:32:06 -0400 Subject: generate, show, solve puzzles --- app/models/wittle/puzzle.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'app/models') diff --git a/app/models/wittle/puzzle.rb b/app/models/wittle/puzzle.rb index e118d8a..f9009bc 100644 --- a/app/models/wittle/puzzle.rb +++ b/app/models/wittle/puzzle.rb @@ -8,5 +8,9 @@ module Wittle validates :category, presence: true enumerize :category, in: [:normal, :hard, :expert], scope: :shallow + + def latest? + Puzzle.where(category: category).order(created_at: :desc).first.id == id + end end end -- cgit 1.4.1