1
0

report_note.rb 579 B

123456789101112131415161718192021
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: report_notes
  5. #
  6. # id :bigint(8) not null, primary key
  7. # content :text not null
  8. # report_id :bigint(8) not null
  9. # account_id :bigint(8) not null
  10. # created_at :datetime not null
  11. # updated_at :datetime not null
  12. #
  13. class ReportNote < ApplicationRecord
  14. belongs_to :account
  15. belongs_to :report, inverse_of: :notes, touch: true
  16. scope :latest, -> { reorder('created_at ASC') }
  17. validates :content, presence: true, length: { maximum: 500 }
  18. end