I'm trying to implement a multi-step registration process. This particular implementation involves OmniAuth, but for the purposes of this discussion it could well be any OAuth provider.
Here are the registration steps we might implement:
Step 1. User clicks Connect with _________.
Step 2. Authorize via _________ and redirect to callback. Pull relevant data from provider and save to your User
model.
Step 3. Pick a username, fill out email address, and any other required data for registering for your app. Also save this to your User
model.
The problem for me lies in the transition from Step 2 to Step 3. I could set validations on the data based on state, using something like state_machine, for example.
However, I would have to remove not-null constraints at the column level for certain essential pieces of data, like username
in my case (which is used for user routes), or email
. I'm not super comfortable removing another layer of data integrity.
I'm sure this problem has been solved a thousand times before. How have you handled it and how would you recommend I handle it?