EndPointCorp / end-point-blog

End Point Dev blog
https://www.endpointdev.com/blog/
17 stars 65 forks source link

Comments for Parsing Email Addresses in Rails with Mail::Address #1041

Open phinjensen opened 6 years ago

phinjensen commented 6 years ago

Comments for https://www.endpointdev.com/blog/2014/10/parsing-email-addresses-in-rails/ By Patrick Lewis

To enter a comment:

  1. Log in to GitHub
  2. Leave a comment on this issue.
phinjensen commented 6 years ago
original author: Kent K.
date: 2014-10-06T03:39:44-04:00

Nice suggestion. While reading it, I couldn't help but consider the possibilities of using composed_of. I think this could plug in very well to Devise provided User accounts.

composed_of :email_address, class_name: "Mail::Address", mapping: [[:email], :first_name], [:last_name]], constructor: ->(email, first_name, last_name) {Mail::Address.new("#{first_name} #{last_name} <#{email}>")})