Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5951769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:35:06+00:00 2026-05-22T17:35:06+00:00

I override devise ‘s confirm! method to send a welcome message to my users:

  • 0

I override devise‘s confirm! method to send a welcome message to my users:

class User < ActiveRecord::Base

  devise :invitable, :database_authenticatable, :registerable, :recoverable, 
         :rememberable, :confirmable, :validatable, :encryptable

  # ...

  # Devise confirm! method overriden
  def confirm!
    UserMailer.welcome_alert(self).deliver
    super
  end

end

With devise_invitable when the user accept the invitation and set his password the confirm! method is never triggered, is it possible to force it? How does devise_invitable confirms the User?

Or maybe I can override the accept_invite (or whatever its called) method the same way?

I want that invited users remain unconfirmed, and then confirmed upon accepting the invitation.

Thanks, any help very appreciated!

Original Source

UPDATE

Looking through devise_invitable model I found the two methods who may be causing this misbehavior:

  # Accept an invitation by clearing invitation token and confirming it if model
  # is confirmable
  def accept_invitation!
    if self.invited? && self.valid?
      self.invitation_token = nil
      self.save
    end
  end

  # Reset invitation token and send invitation again
  def invite!
    if new_record? || invited?
      @skip_password = true
      self.skip_confirmation! if self.new_record? && self.respond_to?(:skip_confirmation!)
      generate_invitation_token if self.invitation_token.nil?
      self.invitation_sent_at = Time.now.utc
      if save(:validate => self.class.validate_on_invite)
        self.invited_by.decrement_invitation_limit! if self.invited_by
        !!deliver_invitation unless @skip_invitation
      end
    end
  end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:35:06+00:00Added an answer on May 22, 2026 at 5:35 pm
    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
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to override the DataGridViewTextBoxCell's paint method in a derived class so
I want to override Devise's RegistrationsContollers ' create action so that when a user
i am trying to override devise registrations controller so that user would be able
In my application I authenticate users using Devise and I noticed that you can
I need to call after_create :something inside overrided Devise class RegistrationsController. Like this: class
I have a Rails 3 project with Devise, confirmable enabled so the user has
public class MyReceiver extends PhoneStateIntentReceiver { @Override public void onReceiveIntent(Context context, Intent intent) {
I wish to override the Devise::RegistrationsController to implement some custom functionalality. To do this,
What's the best practice for redirecting the user, using Devise, back to the page
Is it possible to override default value of WebClientProtocol.Timeout property via web.config? <httpRuntime executionTimeout=500

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.