diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-29 11:32:06 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2023-10-29 11:32:06 -0400 |
| commit | 10599ab2e789ffb93a19f6aa3c100f533c460315 (patch) | |
| tree | f49edb1c44fe698e023a73ee82c1584b328cb5de /app/models | |
| parent | 141f8b1a7e42928e94cccd0c8f89fdd56f8e2efe (diff) | |
| download | wittle-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.rb | 4 |
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 |
| 12 | end | 16 | end |
