KimNorgaard / validates_hostname

Extension to ActiveRecord::Base for validating hostnames and domain names
MIT License
38 stars 12 forks source link

feature: Change to a Rails 4 ActiveModel validator. #11

Closed schwern closed 4 years ago

schwern commented 4 years ago

Closes #10

Rails 4 introduced ActiveModel, ActiveModel::Validations and ActiveModel::EachValidator. Instead of injecting ourselves into ActiveRecord::Base, we will be automatically picked up.

We can now also be used on ActiveModel as well as ActiveRecord. This simplifies testing.

This does mean it requires at least Rails 4. If that's unacceptable I can add a shim for Rails 3.

Also