Sha256: 4be62394841e90dc8b773e92b66a186f12e5eefa56e049fa691c7df0d05f7b8c
Contents?: true
Size: 327 Bytes
Versions: 16
Compression:
Stored size: 327 Bytes
Contents
class SlugValidator < ActiveModel::Validator def validate(record) if Dimensions::Slug.where(value: record.value, slugable_type: record.slugable_type).any? record.errors.add(:slug, "is already in use, chose another one.") end end end module Dimensions class Slug < Dimension validates_with SlugValidator end end
Version data entries
16 entries across 16 versions & 1 rubygems