Sha256: 19c2898a23888f39e8725edb2d7222b7e14a7aefdbbf7596e37e9010d12ca5c3

Contents?: true

Size: 570 Bytes

Versions: 5

Compression:

Stored size: 570 Bytes

Contents

module Marty
  module Notifications
    class Notification < Marty::Base
      self.table_name = 'marty_notifications'

      validates :state, :event_type, presence: true

      has_many(
        :deliveries,
        class_name: '::Marty::Notifications::Delivery',
        dependent: :destroy,
        foreign_key: :notification_id
      )

      state_machine :state, initial: :pending do
        state :pending
        state :processed

        event :set_processed do
          transition processed: same, pending: :processed
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
marty-9.3.0 app/models/marty/notifications/notification.rb
marty-8.5.0 app/models/marty/notifications/notification.rb
marty-8.4.1 app/models/marty/notifications/notification.rb
marty-8.3.1 app/models/marty/notifications/notification.rb
marty-8.2.0 app/models/marty/notifications/notification.rb