Sha256: 9dfd4029e9fdea2230b8a03f233ae2c9c8bf7f70682577b080bdffc0dae9be1b

Contents?: true

Size: 784 Bytes

Versions: 59

Compression:

Stored size: 784 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/events"

module Renalware
  module Events
    class Type < ApplicationRecord
      self.table_name = "event_types"
      DEFAULT_EVENT_CLASS_NAME = "Renalware::Events::Simple"

      acts_as_paranoid

      validates :name, presence: true, uniqueness: true
      validates :slug,
                format: {
                  with: /\A[0-9a-z\-\_]+\z/i,
                  case_sensitive: false
                },
                uniqueness: true,
                allow_nil: true

      scope :visible, -> { where(hidden: false) }

      def self.policy_class
        BasePolicy
      end

      def to_s
        name
      end

      def event_class_name
        super || DEFAULT_EVENT_CLASS_NAME
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
renalware-core-2.0.161 app/models/renalware/events/type.rb
renalware-core-2.0.160 app/models/renalware/events/type.rb
renalware-core-2.0.159 app/models/renalware/events/type.rb
renalware-core-2.0.158 app/models/renalware/events/type.rb
renalware-core-2.0.157 app/models/renalware/events/type.rb
renalware-core-2.0.156 app/models/renalware/events/type.rb
renalware-core-2.0.155 app/models/renalware/events/type.rb
renalware-core-2.0.153 app/models/renalware/events/type.rb
renalware-core-2.0.152 app/models/renalware/events/type.rb
renalware-core-2.0.151 app/models/renalware/events/type.rb
renalware-core-2.0.149 app/models/renalware/events/type.rb
renalware-core-2.0.148 app/models/renalware/events/type.rb
renalware-core-2.0.147 app/models/renalware/events/type.rb
renalware-core-2.0.146 app/models/renalware/events/type.rb
renalware-core-2.0.145 app/models/renalware/events/type.rb
renalware-core-2.0.144 app/models/renalware/events/type.rb
renalware-core-2.0.143 app/models/renalware/events/type.rb
renalware-core-2.0.142 app/models/renalware/events/type.rb
renalware-core-2.0.141 app/models/renalware/events/type.rb
renalware-core-2.0.140 app/models/renalware/events/type.rb