Sha256: 0d5a12bda603886abc4872e08593d0249c221f4bee8370118604952cae958e16

Contents?: true

Size: 898 Bytes

Versions: 1

Compression:

Stored size: 898 Bytes

Contents

require 'active_support/concern'
require 'active_model/validations'
require 'circuit/validators'

module Circuit
  module Storage
    module Sites
      # @abstract include into a Class or Module to setup the necessary methods
      # for a Site model
      module Model
        # Validations for Site models
        # * validates the host's format and presence
        # * validates the aliases' formats
        # @see Circuit::Validators::DomainValidator
        # @see Circuit::Validators::DomainArrayValidator
        # @abstract include into a Site class or Module to add the Validations
        module Validations
          extend ActiveSupport::Concern
          include ActiveModel::Validations

          included do
            validates :host, :presence => true, :domain => true
            validates :aliases, :domain_array => true
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
circuit-0.2.0 lib/circuit/storage/sites/model.rb