devise invitable getting invalid token

I'm using Devise and Devise-invitable. However when I try to accept an invitation, it says the token is invalid. There's an issue with the new devise on how it saves the token...which I know is causing the issue (

However, i'm not sure how to fix it still. The creator says use @token...but I have no idea how to get @token. Where does this variable come from? Here's what I have so far:

class Users::InvitationsController < Devise::InvitationsController

  def invite_resource
    resource_class.invite!(email: params['user']['email'], company_id: do |u|
      # skip sending emails on invite
      u.invited_by_id      =
      u.invited_by_type    = 'User'
      u.skip_invitation    = true
      u.invitation_sent_at =

  def accept_resource
    resource = resource_class.accept_invitation!(update_resource_params)

and the link I'm using:

= link_to 'Accept invitation', accept_invitation_url('user', :invitation_token => @token)

previously instead of @token I am using invitation.invitation_token but I guess that's not a hashed version? How do I insert the correct version into the above acceptance link?


Your emails link looks fine as @token is generated by the mailer. If you are like me you could have an invalid column type. For example, on mine invitation_created_at was the wrong type, so I did a migration to change it to datetime:

class ChangeUsersInvitationCreatedAtToDatetime < ActiveRecord::Migration
  def change
    change_column :users, :invitation_created_at, :datetime

Need Your Help

How to append bootstrapped values of cluster's (tree) nodes in NEWICK format in R

r tree cluster-analysis dendrogram pvclust

I want to make a tree (cluster) using Interactive Tree of Life web-based tool (iTOL). As an input file (or string) this tool uses Newick format which is a way of representing graph-theoretical tree...