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

  • SEARCH
  • Home
  • 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 7026547
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:07:55+00:00 2026-05-28T00:07:55+00:00

I have a bunch of code that hands over stuff from a logged in

  • 0

I have a bunch of code that hands over stuff from a logged in user’s guest/lazy registered account to his new account which I run when a new session is created.

class SessionsController < Devise::SessionsController

  def new
    super
  end

  def create
    super
    logging_in # this is the method which will run
  end

  def destroy
    super
  end

end

It works when the user logs in. However when Devise logs a user in after confirmation, the above does not get run. Where should I put the method if I want it to run after a user logs in? whether by logging in or confirmation.

  • 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-28T00:07:56+00:00Added an answer on May 28, 2026 at 12:07 am

    Thanks nash. Here’s how I did it.

    class ConfirmationsController < Devise::ConfirmationsController
    
      def new
        super
      end
    
      def create
        super
      end
    
      def show
        self.resource = resource_class.confirm_by_token(params[:confirmation_token])
    
        if resource.errors.empty?
          set_flash_message(:notice, :confirmed) if is_navigational_format?
          sign_in(resource_name, resource)
          logging_in # Here it is
          respond_with_navigational(resource){ redirect_to after_confirmation_path_for(resource_name, resource) }
        else
          respond_with_navigational(resource.errors, :status => :unprocessable_entity){ render :new }
        end
      end
    
      protected
    
        def after_resending_confirmation_instructions_path_for(resource_name)
          new_session_path(resource_name)
        end
    
        def after_confirmation_path_for(resource_name, resource)
          after_sign_in_path_for(resource)
        end
    
    end
    

    It needs to be added after sign_in because my logging_in method uses current_user.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have a bunch of code that I'm pulling from a column in
I have a bunch of generic code that is used a lot, which i'd
I have a bunch of PHP code that is auto-generated and it puts all
I have a bunch of Workflow foundation 4.0 RC code activities that consume web
I have code that loads a bunch of images into hidden img elements and
I have a .net assembly that contains data access code (a bunch of Typed
I have an Excel file that has a bunch of VBA and macro code
I have a bunch of these little bits of HTML code repeated over and
I have run across a bunch of code in a few C# projects that
Project is C#. So I have a bunch of multithreaded code that is designed

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.