Progress on dms, code cleanup
Progress on dms, code cleanup
This commit is contained in:
27
app/models/chat_message.rb
Normal file
27
app/models/chat_message.rb
Normal file
@@ -0,0 +1,27 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user