Gab-Social/app/models/chat_message.rb
mgabdev 9a43c51085 Progress on dms, code cleanup
Progress on dms, code cleanup
2020-12-02 23:22:51 -05:00

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