Skip to content

Commit 7395af7

Browse files
committed
Add custom archived scope for ordering
1 parent dd84a8f commit 7395af7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

app/models/puzzle.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ class Puzzle < ApplicationRecord
22
enum :answer, ruby: 0, rails: 1
33
enum :state, { approved: 0, rejected: 1, pending: 2, archived: 3 }
44
has_many :answers
5+
6+
scope :archived, -> { Puzzle.where(state: :archived).order(sent_at: :desc) }
57
end

0 commit comments

Comments
 (0)