Sha256: aba3c1c2fd00a123a67592fad028a184c04bbb134f0dd398394ac7e76f802b8c

Contents?: true

Size: 349 Bytes

Versions: 1

Compression:

Stored size: 349 Bytes

Contents

if Gem::Specification::find_all_by_name('activerecord').any?
  require 'active_model'
  class ProhibitedValidator < ::ActiveModel::EachValidator
    def validate_each(record, attribute, value)
      if ProhibitedUsernames::include?(value)
        record.errors[attribute] << (options[:message] || "#{value} is reserved")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
prohibited-usernames-0.1.1 lib/prohibited/prohibited_validator.rb