Sha256: 4887df306e0b9461dfb9c02ed5581a525b8ff30ada2a6a1518bc571505aed9c2

Contents?: true

Size: 248 Bytes

Versions: 2

Compression:

Stored size: 248 Bytes

Contents

class SlugValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)
    unless value =~ /^[a-z0-9-]+$/
      record.errors[attribute] << (options[:message] || I18n.t('yukonisuru.errors.messages.slug'))
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
yukonisuru-1.0.0 lib/yukonisuru/validators/slug_validator.rb
yukonisuru-0.0.1 lib/yukonisuru/validators/slug_validator.rb