A simple validator for email addresses. Internally, the mail gem is utilized to parse the email address.
LoLwut? Why not use a regex?
Rails already depends on the mail gem, so why not utilize that dependency to parse email addresses properly? Framework wise, it makes sense that we would rely on the mail gem for all things email related.
class User < ActiveRecord::Base validates :email, "MailValidation::Email" => true end
With just ActiveModel:
class User include ActiveModel::Model end
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install mail_validation
TODO: Write usage instructions here
- Fork it
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create new Pull Request