Add a user by another user

Viewed 85

I have a User devise model. Is there any way to add a user to the same user devise model by an already registered user?

  1. User A makes registration.
  2. User A confirms an email.
  3. User A becomes admin.
  4. User A adds another user B using email.
  5. Email verification is sent to user B.

I have done the first three steps. Pleas provide me an idea to do the rest.

1 Answers

devise_invitable https://github.com/scambra/devise_invitable is the best solution i found out.

Below providing the steps:

Assuming you created the devise user model and configured the action mailer.

  1. addgem 'devise_invitable
  2. In your cmd bundle install
  3. rails generate devise_invitable:install
  4. rails generate devise_invitable user
  5. rake db:migrate
  6. rails generate devise_invitable:views users
  7. Now in your browser sign up or sign in to an already registered account.
  8. Goto http://localhost:3000/users/invitation/new .
  9. here you can provide the email id of whom you want to invite.
Related