Skip to content

Instantly share code, notes, and snippets.

@roadev
Forked from benoror/user.rb
Last active Aug 29, 2015
Embed
What would you like to do?
devise_invitable: Confirm after set password
class User < ActiveRecord::Base
devise :invitable, :database_authenticatable, :registerable, :recoverable,
:rememberable, :confirmable, :validatable, :encryptable
# ...
# devise confirm! method overriden
def confirm!
welcome_message
super
end
# devise_invitable accept_invitation! method overriden
def accept_invitation!
self.confirm!
super
end
# devise_invitable invite! method overriden
def invite!
super
self.confirmed_at = nil
self.save
end
private
def welcome_message
UserMailer.welcome_message(self).deliver
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment