kennethkalmer/powerdns-on-rails

View on GitHub
lib/hostname_validator.rb

Summary

Maintainability
A
0 mins
Test Coverage
class HostnameValidator < ActiveModel::EachValidator
  include RecordPatterns

  def validate_each( record, attribute, value )
    record.errors[ attribute ] << I18n.t(:message_attribute_must_be_hostname) unless hostname?( value ) && !ip?( value )
  end

end