Q:

Devise Invitable send different emails based on the type of user

I was using devise_invitable in previous versions to send different invitation emails to different user roles. For example, an Admin user would get sent a different invitation than just a regular user. To send the different emails to the users I did the following:
 @user = User.invite!(params[:user], current_user) do |u|
   u.skip_invitation = true
 end

if params[:admin_id] # admin invite
  @user.deliver_invitation
  email = NotificationMailer.admin_invite_message(@user, @venue, @from, @subject, @content)
else
  @user.deliver_invitation
  NotificationMailer.user_invite_message(@user, @from, @subject, @content)
end

This type of approach gives a great deal of flexibility. But with the newest changes to the way the token is generate (see below), it is no longer possible to use this approach.
# Generates a new random token for invitation, and stores the time
# this token is being generated
def generate_invitation_token
  raw, enc = Devise.token_generator.generate(self.class, :invitation_token)
  @raw_invitation_token = raw
  self.invitation_token = enc
end

Using resource.invitation_token now yields an encrypted version of the token and there is no way to grab the raw token from my NotificationMailer so I can send it to the user.
Any tips and work arounds would be greatly appreciated.
(opened an issue on the devise invitable github)

A:

To get access to @raw_invitation_token you simply need to add: attr_reader :raw_invitation_token to the User model.

