ValidatesHost
Rails gem to validate Host Related fields.
Installation
Add this line to your application's Gemfile:
gem 'validates_host'
And then execute:
$ bundle
Or install it yourself as:
$ gem install validates_host
Usage
Lets say you have a model that you want to have valid host fields. Just add this to your model:
class Server < ActiveRecord::Base
validates :domain_name, :domain_name => true
validates :host_name, :host_name => true
validates :ip, :ip => true
end
class Subnet < ActiveRecord::Base
validates :value, :subnet => true
end
Test
This gem has builtin matchers for shoulda-matchers and remarkable.
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request