I got tired of hackish regex validations for domain names, so I spent a little bit of time to come up with a custom DomainValidator that can be used over and over, and perhaps worked into a gem.
The neat thing about writing a validator like this is it can be used over and over by simply specifying :domain => true in the model's validates call. Like this:
validates :name, :presence => true, :domain => true
Is this the best way to do this though? What have others done for validating domain names?
Rietta.com - Web Apps Where Security Matters[masked] (Direct) |
[address removed] | Skype: frankrietta
We develop and maintain Ruby on Rails web applications. We're an EngineYard Partner.