Module | Sequel::Plugins::ValidationClassMethods
In: | lib/sequel/plugins/validation_class_methods.rb

Sequel‘s built-in validation_class_methods plugin adds backwards compatibility for the legacy class-level validation methods (e.g. validates_presence_of :column).

It is recommended to use the validation_helpers plugin instead of this one, as it is less complex and more flexible. However, this plugin provides reflection support, since it is class-level, while the instance-level validation_helpers plugin does not.

Usage:

      # Add the validation class methods to all model subclasses (called before loading subclasses)
      Sequel::Model.plugin :validation_class_methods

      # Add the validation class methods to the Album class
      Album.plugin :validation_class_methods

### Methods

apply

### Classes and Modules

Module Sequel::Plugins::ValidationClassMethods::ClassMethods
Module Sequel::Plugins::ValidationClassMethods::InstanceMethods

### Public Class methods

apply(model)

Setup the validations hash for the given model.

[Source]

        # File lib/sequel/plugins/validation_class_methods.rb, line 22
    22:       def self.apply(model)
    23:         model.class_eval do
    24:           @validation_mutex = Mutex.new
    25:           @validations = {}
    26:           @validation_reflections = {}
    27:         end
    28:       end

[Validate]