about summary refs log tree commit diff stats
path: root/app/models
diff options
context:
space:
mode:
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