Sha256: ec2e75ec005f94ff996a00ac8f318ea6fee8339e937db91731f832128e6e4db8
Contents?: true
Size: 273 Bytes
Versions: 6
Compression:
Stored size: 273 Bytes
Contents
module Amalgam::Validator class Slug < ActiveModel::Validator def validate(record) slug_field = options[:field] || :slug unless record.send(slug_field) =~ /\A[0-9a-z\-_]+\z/ record.errors.add(attribute, :invalid, options) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems