Sha256: 5cfc4151e11db4e895ea05bbe39ecf10d601a38a0c85dc74b1794aff12ea8c1f

Contents?: true

Size: 672 Bytes

Versions: 24

Compression:

Stored size: 672 Bytes

Contents

require_dependency "renalware/messaging"

module Renalware
  module Messaging
    module Internal
      class Receipt < ApplicationRecord
        validates :recipient, presence: true
        validates :message, presence: true

        belongs_to :message
        belongs_to :recipient

        scope :unread, -> { where(read_at: nil) }
        scope :read, -> { where.not(read_at: nil) }
        scope :ordered, -> { joins(:message).merge(Message.ordered) }
        scope :sent_by, lambda{ |user_id|
          joins(:message).where(messaging_messages: { author_id: user_id })
        }

        def read?
          read_at.present?
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
renalware-core-2.0.8 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.7 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.5 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.4 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.3 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.2 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.1 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc13 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc11 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc10 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc9 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc8 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc7 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc6 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc5 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc4 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc3 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.rc1 app/models/renalware/messaging/internal/receipt.rb
renalware-core-2.0.0.pre.beta12 app/models/renalware/messaging/internal/receipt.rb