9a43c51085
Progress on dms, code cleanup
28 lines
742 B
Ruby
28 lines
742 B
Ruby
# frozen_string_literal: true
|
|
# == Schema Information
|
|
#
|
|
# Table name: chat_messages
|
|
#
|
|
# id :bigint(8) not null, primary key
|
|
# account_id :bigint(8) not null
|
|
# chat_conversation_id :bigint(8) not null
|
|
# text :text default(""), not null
|
|
# language :string
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
|
|
class ChatMessage < ApplicationRecord
|
|
include Paginable
|
|
|
|
belongs_to :from_account, class_name: 'Account'
|
|
belongs_to :chat_conversation
|
|
|
|
validates_with ChatMessageLengthValidator
|
|
|
|
default_scope { recent }
|
|
|
|
scope :recent, -> { reorder(created_at: :desc) }
|
|
|
|
end
|