Sha256: a85a52f3c401a91a3a961b2488b61843a6432ccceaabfb96d4ca0f0c6f0567a3
Contents?: true
Size: 403 Bytes
Versions: 32
Compression:
Stored size: 403 Bytes
Contents
class ChatMessageUser < AbstractAdapter belongs_to :chat_message belongs_to :user has_one :chat, through: :chat_message scope :read, ->{ where('read_at IS NOT NULL' ) } scope :unread, ->{ where('read_at IS NULL' ) } before_save :author_reads_message def author_reads_message self.read_at = Time.now if user == chat_message.author end def read? read_at.present? end end
Version data entries
32 entries across 32 versions & 2 rubygems