Sha256: 8474f15d5c3a13aab7e0acae4bf28568a884a0c075d70ad8fe24a5ed82232523
Contents?: true
Size: 396 Bytes
Versions: 3
Compression:
Stored size: 396 Bytes
Contents
#!/usr/bin/env ruby require 'flapjack' module Flapjack module Data module Validators class IdValidator < ActiveModel::Validator UUID_REGEXP = /^#{Flapjack::UUID_RE}$/ def validate(record) if !record.id.nil? && UUID_REGEXP.match(record.id.to_s).nil? record.errors.add(:id, 'is not a UUID') end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flapjack-2.0.0 | lib/flapjack/data/validators/id_validator.rb |
flapjack-2.0.0rc1 | lib/flapjack/data/validators/id_validator.rb |
flapjack-2.0.0b1 | lib/flapjack/data/validators/id_validator.rb |