Sha256: 04348880beb4164f5c05cb9d4c3eba3795d6a79ec9cf180e4e4431a7456fa436
Contents?: true
Size: 945 Bytes
Versions: 48
Compression:
Stored size: 945 Bytes
Contents
# frozen_string_literal: true # https://guides.rubyonrails.org/active_record_validations.html#validates-with module Dsu module Validators class VersionValidator < ActiveModel::Validator def validate(record) version = record.version if version.nil? record.errors.add(:version, 'is nil') return end unless version.is_a?(Integer) record.errors.add(:version, 'is the wrong object type. ' \ "\"Integer\" was expected, but \"#{version.class}\" was received.") nil end # TODO: This validation should check the configuration version # against the current migration version and they should match. # unless version == record.class::VERSION # record.errors.add(:version, "\"#{version}\" is not the correct version: \"#{record.class::VERSION}\"") # end end end end end
Version data entries
48 entries across 48 versions & 1 rubygems