I'm having trouble with the callbacks in devise_invitable - specifically, they seem to be undefined.
If I try to add:
before_invitation_created :set_pending_invite
to my user model, I get the following error
undefined method `before_invitation_created'
Is there a trick to getting the callbacks to be recognized? Do I need to add something to my controller?
I do have :invitable in my model:
class User < ActiveRecord::Base
has_many :pending_sites
rolify :role_cname => 'Group'
devise :invitable, :database_authenticatable, :zxcvbnable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :omniauthable, :omniauth_providers => [:saml]
before_invitation_created :set_pending_invite
after_initialize :set_default_role, :if => :new_record?
I'm having the same issue. I looked into it, and the master branch defines those callbacks, but they're not released yet. As of this writing, the latest release is 1.5.5 from Dec 17th, 2015 and the commit with the new callbacks wasn't made until Dec 29th, 2015 (https://github.com/scambra/devise_invitable/commit/3834b65bf1b979a4e9c8c1ac9769ea881e350c80)
Furthermore, if you want to use the latest, you can put this in your Gemfile:
gem 'devise_invitable', :git => '[email protected]:scambra/devise_invitable.git'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With