Sha256: 2dd5516d223488949ba9611c9b42f2be364a0a529099908ef9ed14f269d4ec09

Contents?: true

Size: 668 Bytes

Versions: 16

Compression:

Stored size: 668 Bytes

Contents

module Marty
  module Notifications
    class Config < Marty::Base
      self.table_name = 'marty_notifications_configs'

      AVAILABLE_TYPES = ::Marty::Notifications::Delivery.
        state_machines[:delivery_type].states.map(&:value)

      belongs_to :recipient, class_name: '::Marty::User'

      validates :recipient, presence: true

      validates :delivery_type, presence: true, inclusion: { in: AVAILABLE_TYPES }

      validates :delivery_type,
                presence: true,
                uniqueness: { scope: [:event_type, :recipient_id] }

      state_machine :state, initial: :on do
        state :off
        state :on
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
marty-14.3.0 app/models/marty/notifications/config.rb
marty-14.0.0 app/models/marty/notifications/config.rb
marty-13.0.2 app/models/marty/notifications/config.rb
marty-11.0.0 app/models/marty/notifications/config.rb
marty-10.0.3 app/models/marty/notifications/config.rb
marty-10.0.2 app/models/marty/notifications/config.rb
marty-10.0.0 app/models/marty/notifications/config.rb
marty-9.5.1 app/models/marty/notifications/config.rb
marty-9.5.0 app/models/marty/notifications/config.rb
marty-9.3.3 app/models/marty/notifications/config.rb
marty-9.3.2 app/models/marty/notifications/config.rb
marty-9.3.0 app/models/marty/notifications/config.rb
marty-8.5.0 app/models/marty/notifications/config.rb
marty-8.4.1 app/models/marty/notifications/config.rb
marty-8.3.1 app/models/marty/notifications/config.rb
marty-8.2.0 app/models/marty/notifications/config.rb