Refactor: use idiomatic .last instead of .order(:desc).first (#2098)

Simplifies the last_event method in ActivitySpike::Detector by using
the more idiomatic Rails pattern .order(:created_at).last instead of
.order(created_at: :desc).first. Both generate the same SQL query but
.last is more readable and conventional in Rails codebases.
This commit is contained in:
Ítalo Matos
2025-12-12 01:35:38 -03:00
committed by GitHub
parent 2e17b78e08
commit 0833c52aa0
+1 -1
View File
@@ -51,6 +51,6 @@ class Card::ActivitySpike::Detector
end
def last_event
card.events.order(created_at: :desc).first
card.events.order(:created_at).last
end
end