addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupsimageimagesinstagramlinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1outlookpersonJoin Group on CardStartprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Got tired of regexes for domain validation, so made this

From: Frank R.
Sent on: Thursday, October 4, 2012 5:01 PM
Hi All,

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?


--- - 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.

Our Sponsors

  • Mandrill

    Sponsors food, meeting space, and other expenses.

  • Pardot

    Sponsors food, meeting space, and other expenses.

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy