Home > Enterprise >  Override Devise Invitable `invite!` method in order to add attachment to invitation email - Rails
Override Devise Invitable `invite!` method in order to add attachment to invitation email - Rails

Time:09-22

I have devise_invitable gem and an invitations controller InvitationsController < Devise::InvitationsController. I invite my user with this method User.invite!(user, inviter) from the gem.

Now, I would like to add pdf attachment to this invitation but I am not able to override the mailer method in order to do stuff like this: attachments['terms.pdf'] = File.read('/path/terms.pdf').

My invitation email is working fine and I would like to keep it like that but with an attachment.

Here my routes.rb:

devise_for :users, controllers: { invitations: 'api/v1/users/invitations' }

What am I missing?

Thanks

  • Related