Simple invitation access code using Rails 4 & Devise
Want a user to provide a simple access/invitation code to register for an account using Rails 4 and devise?
See my github gist below. Supports having one dumb access code, nothing fancy. But, worth sharing: it’s not immediately straight forward how to do this.
This is achieved by:
– Setting up a virtual attribute on the user model called invitation_code
– Telling Rails strong parameters to allow invitation_code as an attribute on user when signing up
– Adds form field for invitation_code on the registration page