gems for validating email and urls in rails

Validating URL Addresses

  • http_url_validation_improved (1.3.1) – uses Addressable::URI.parse, can check url connectivity
  • url_validation (1.0.0) – uses Addressable::URI.parse, can check url connectivity
  • url_validator (0.1.0) – uses Addressable::URI.parse
  • validate_url (0.2.0) – simple, Rails 3 only, uses URI.parse
  • validates_url_format_of (0.3.0) – Rails 2 and 3, uses regexp

Obviously people’s needs will differ but I think validate_url suites my needs best: it doesn’t add a dependency on Addressable and doesn’t use a regexp for validation. Mostly I’m looking to prevent user entry errors link failing to provide a schema. Whether the site exists is not something I need to check in a validation.

Validating Email Addresses

There are about 28 gems for doing email address validation. I’ve been using validates_email_format_of for quite some time with no complaints. It can validate mx records, works in Rails 2 and 3, and is highly configurable. Until I see a reason to switch I’ll keep using it.

Leave a Reply

Your email address will not be published. Required fields are marked *