Search code examples
ruby-on-railsrubydevisedevise-invitable

How do I resend invitation to a user using devise invitable?


I have devise invitable gem Hooked up in my app as well as devise.

Everything working fine. When I create new user, they are saved in database and mailer sends email an email address. User clicks on email, sets password and then is logged in.

But sometimes these users lose their email or rather can’t find it in their email inbox. I’d like to have a resend invite button on the users index page.

When user clicks resend, I want the invites user to get another email sent to them.

Had anyone successfully accomplished this with devise invitable? If so, can you share how?


Solution

  • The gem adds a resend_invitation configuration parameter on your invitable-enabled model. From the docs:

    resend_invitation: resend invitation if user with invited status is invited again. Enabled by default.

    So, calling .invite! again on a record that's marked as invited will do the trick for you.