Sha256: 503ee9d5b8867d6d4a0eb87082101f9977e8a610ed3063920df0e36e8d18b3cf

Contents?: true

Size: 524 Bytes

Versions: 3

Compression:

Stored size: 524 Bytes

Contents

module Ddr
  module Alerts
    class Message < ActiveRecord::Base

      has_many :contexts, class_name: "Ddr::Alerts::MessageContext", inverse_of: :message, dependent: :destroy

      scope :active, -> { where(active: true) }

      scope :ddr, -> { joins(:contexts).where(ddr_alerts_message_contexts: { context: Ddr::Alerts::MessageContext::CONTEXT_DDR }) }
      scope :repository, -> { joins(:contexts).where(ddr_alerts_message_contexts: { context: Ddr::Alerts::MessageContext::CONTEXT_REPOSITORY }) }

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ddr-alerts-0.2.0 lib/ddr/alerts/message.rb
ddr-alerts-0.1.1 lib/ddr/alerts/message.rb
ddr-alerts-0.1.0 lib/ddr/alerts/message.rb