Module: ROM::Model::Validator

Defined in:
lib/rom/model.rb

Overview

Mixin for ROM-compliant validator objects

Examples:


class UserParams
  include ROM::Model::Params

  attribute :name

  validates :name, presence: true
end

class UserValidator
  include ROM::Model::Validator
end

params = UserParams.new(name: '')
UserValidator.call(params) # raises ValidationError

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



84
85
86
# File 'lib/rom/model.rb', line 84

def self.included(base)
  base.extend(ClassMethods)
end