Sha256: 6e1a00ec4220825961365f8197134aad744d1419e6ce7c93e4f031769fd86cdc

Contents?: true

Size: 605 Bytes

Versions: 11

Compression:

Stored size: 605 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,
        inverse_of: :notification
      )

      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

11 entries across 11 versions & 1 rubygems

Version Path
marty-14.3.0 app/models/marty/notifications/notification.rb
marty-14.0.0 app/models/marty/notifications/notification.rb
marty-13.0.2 app/models/marty/notifications/notification.rb
marty-11.0.0 app/models/marty/notifications/notification.rb
marty-10.0.3 app/models/marty/notifications/notification.rb
marty-10.0.2 app/models/marty/notifications/notification.rb
marty-10.0.0 app/models/marty/notifications/notification.rb
marty-9.5.1 app/models/marty/notifications/notification.rb
marty-9.5.0 app/models/marty/notifications/notification.rb
marty-9.3.3 app/models/marty/notifications/notification.rb
marty-9.3.2 app/models/marty/notifications/notification.rb