about summary refs log tree commit diff stats
path: root/app/models
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2023-10-29 11:32:06 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2023-10-29 11:32:06 -0400
commit10599ab2e789ffb93a19f6aa3c100f533c460315 (patch)
treef49edb1c44fe698e023a73ee82c1584b328cb5de /app/models
parent141f8b1a7e42928e94cccd0c8f89fdd56f8e2efe (diff)
downloadwittle-10599ab2e789ffb93a19f6aa3c100f533c460315.tar.gz
wittle-10599ab2e789ffb93a19f6aa3c100f533c460315.tar.bz2
wittle-10599ab2e789ffb93a19f6aa3c100f533c460315.zip
generate, show, solve puzzles
Diffstat (limited to 'app/models')
-rw-r--r--app/models/wittle/puzzle.rb4
1 files changed, 4 insertions, 0 deletions
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
8 8
9 validates :category, presence: true 9 validates :category, presence: true
10 enumerize :category, in: [:normal, :hard, :expert], scope: :shallow 10 enumerize :category, in: [:normal, :hard, :expert], scope: :shallow
11
12 def latest?
13 Puzzle.where(category: category).order(created_at: :desc).first.id == id
14 end
11 end 15 end
12end 16end