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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user