I use rails with a device to register. I also added an invitation code, so not everyone can register.
The invitation code is transmitted through a query string like "/ users / sign_up? Invite_code = wajdpapojapsd" and added to the hidden field of the registration form using "f.hidden_field: invite_code ,: value => params [:. Invite_code]"
It works very well. The only problem is that if the registration is not checked and not rejected, create redirects to "/ users" and lose the query string with the invitation in it.
Since the email remains in the registration form after an unsuccessful attempt, I believe that this should also work for the invitation code. As the worst solution for solving problems: back after unsuccessful registration and loss of email, but keeping the invitation code will be better than now.
EDIT: So far, I have created a registration controller for development, but I donβt know how to achieve the desired behavior.
Any help on how to save the query string or just the invitation code would be amazing.
source share