mirror of
https://github.com/mastodon/mastodon.git
synced 2024-09-19 11:55:15 +00:00
Use arel order in account associations
This commit is contained in:
parent
c3435191a1
commit
fd74536f13
|
@ -26,7 +26,7 @@ module Account::Associations
|
|||
|
||||
# Pinned statuses
|
||||
has_many :status_pins, inverse_of: :account, dependent: :destroy
|
||||
has_many :pinned_statuses, -> { reorder('status_pins.created_at DESC') }, through: :status_pins, class_name: 'Status', source: :status
|
||||
has_many :pinned_statuses, -> { StatusPin.latest }, through: :status_pins, class_name: 'Status', source: :status
|
||||
|
||||
# Endorsements
|
||||
has_many :account_pins, inverse_of: :account, dependent: :destroy
|
||||
|
|
|
@ -17,6 +17,8 @@ class StatusPin < ApplicationRecord
|
|||
|
||||
validates_with StatusPinValidator
|
||||
|
||||
scope :latest, -> { reorder(created_at: :desc) }
|
||||
|
||||
after_destroy :invalidate_cleanup_info
|
||||
|
||||
def invalidate_cleanup_info
|
||||
|
|
Loading…
Reference in a new issue