docbrown/app/models/note.rb
Philip How 2ff439da80
Improve abuse reports UX (#20433)
* change to buttons + updates to styles

* add expand/collapse all and increase number of displayed entries

* fix a11y

* fix show route + order vomits by users first

---------

Co-authored-by: Mac Siri <mac@forem.com>
2023-12-13 15:31:09 +00:00

13 lines
523 B
Ruby

# @note When we destroy the related user, it's using dependent:
# :delete for the relationship. That means no before/after
# destroy callbacks will be called on this object.
class Note < ApplicationRecord
belongs_to :author, class_name: "User", optional: true
belongs_to :noteable, polymorphic: true, touch: true
validates :content, :reason, presence: true
def self.find_for_reports(feedback_message_ids)
includes(:author).where(noteable_id: feedback_message_ids).order(:created_at)
end
end