Sha256: 3b8ed3735113ecc48738ffcee222f2b636d0efe20a4c89891c61489c2aa1e71a

Contents?: true

Size: 631 Bytes

Versions: 2

Compression:

Stored size: 631 Bytes

Contents

# frozen_string_literal: true

module RubyRabbitmqJanus
  module Models
    # Configure validation for JanusInstance model
    module JanusInstanceValidations
      extend ActiveSupport::Concern

      included do
        # Instance number it's mandatory, unique and with type Integer
        validates :instance, presence: true,
                             numericality: { only_integer: true },
                             uniqueness: true
        # This instance it's a state (enable or disable)
        validates :enable, presence: true,
                           inclusion: { in: [true, false] }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.2.0.pre.159 lib/rrj/models/concerns/janus_instance_validations.rb
ruby_rabbitmq_janus-2.2.0.pre.42 lib/rrj/models/concerns/janus_instance_validations.rb