This project is about 'Generate Secret Code to be used on Sign up page' with details implemented as per below guidelines:
-
Create a clean ruby on rails application using twitter bootstrap.
-
Create User model with fields first name, last name, email.
-
Install and setup devise gem to use the User model for auth (email used as a user name).
-
Generate devise views via rake command.
-
On the register new user view add a new text field called Secret Code.
-
Restrict user registration so a hard coded secret code must be entered, eg. 'foobar'.
-
Create a new user with seeds called 'admin'.
-
Create a controller/model SecretCode (1-to-1 relationship to Users which can be null, plus code string and usual created/updated).
-
The controller needs to provide a view and actions to generate a number of secret codes.
-
Index page shows secret codes available, and the associated user email address for ones that have an association.
-
Index page also has a button to generate more secret code models which by default have no associated user and a randomly generated secret code (some short hash or guid).
-
The index page also has a drop down filled with 1, 10, 20, 50, 100 which determines how many secret codes to generate (default selection on drop down is 10).
-
Link secret code field on user registration page to only allow available secret code models (one with no current user associated).
-
Registering a user will create association between user and the valid secret code they used.
-
Secret code index page should show user email address for a secret code after they use it for registration in a table next to the code.
-
Setup CanCanCan ACL gem.
-
Create a role called :admin and manually in DB associate it with the admin user created manually earlier (no UI needed for this config).
-
Configure so that SecretCode page link and entire controller is only accessible to :admin role users.