Search code examples
ruby-on-railsdevisedevise-invitable

Decline user invitation - devise_invitable


I have integrated devise_invitable gem in my rails application to implement invite users functionality. It works good for users when they accept invitation. Is there a way to provide option for the users to decline the invitation (similar to accept invitation)? Along with the invitation email, I want to add opt out / decline link so that the application does not send further invitations to this user.


Solution

  • It is possible with devise invitable configuration variable. You can look into this url. This is not direct way to achieve this. By setting resend_invitation invitation email will sent to user only once.

    You can setup this in two ways: In model itself

    devise :database_authenticatable, :confirmable, :invitable, :resend_invitation => false
    

    In Devise initializer :

    config.resend_invitation = false