Skip to content

Commit 5bf649d

Browse files
committed
Update application_record.rb
1 parent 3a438fb commit 5bf649d

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

app/models/application_record.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class ApplicationRecord < ActiveRecord::Base
88
has_many(:linked_notifications, class_name: 'Notification',
99
as: :linkeable, dependent: :nullify
1010
)
11-
has_many(:reports, as: :linkeable, dependent: :destroy)
11+
has_many(
12+
:reports, ->{ order(created_at: :desc) },
13+
as: :linkeable, dependent: :destroy
14+
)
1215

1316
def qualified_id
1417
'%s:%i' % [self.class.to_s, id]

0 commit comments

Comments
 (0)