lundi 2 novembre 2015

Creating a user from an array of emails

Im creating an api to create a new userS(plural) from an array of emails.

We are assuming that there are no validations other than user requires an email. So all i need is an email to create a user.

Reason i'm doing this is because i'm creating an API.

How do i create users from an array of emails?

Here is the array. I actually have real emails but for this example i will make them up.

# => [
#     [0] "email1@example.com.au",
#     [1] "email2@example.com.au",
#     [2] "email3@example.com",
#     [3] "email4@example.com.au",
#     [4] "email5@example.com.au"
# ]

To create a user it's just the typical way

User.new(email: 123@example.com)

Thanks in advance for any help.

Aucun commentaire:

Enregistrer un commentaire