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 8039413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:33:41+00:00 2026-06-05T03:33:41+00:00

I have this method: def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user])

  • 0

I have this method:

  def update
    @user = User.find(params[:id])
    respond_to do |format|
      if @user.update_attributes(params[:user])
        if params[:mypmnode]
          session[:return_to] = projects_pmnode_path(params[:mypmnode])
          sign_in(@user)
        end
        format.html { redirect_to(session[:return_to], :notice => 'User was successfully updated.') }
        format.xml  { head :ok }
      else
        @create_company = true if params[:user][:company_id].blank? and  params[:user][:company_attributes].length > 0
        @create_department = true if params[:user][:department_id].blank? and  params[:user][:department_attributes].length > 0
        format.html { render :action => "edit" }
        format.xml  { render :xml => @user.errors, :status => :unprocessable_entity }
      end
    end
  end

The idea is that if the user is updated, He is automatically signed-in and redirected to a page where authentication is required.

In this page, I have: before_filter :authenticate_user!

This doesn’t work on redirect.

If I then go to another page making use of this sign_in function, then the user logs-in correctly.

Any idea why redirect doesn’t work? Thx!

UPDATE:

to make it clearer, I insert the second page code (controller):

class PmnodesController < Projects::BaseController

  before_filter authenticate_user!

  def index
    @pmnodes = Pmnode.all
    respond_to do |format|
      format.html 
    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-06-05T03:33:42+00:00Added an answer on June 5, 2026 at 3:33 am

    If the password is updated on @user, devise will invalidate the session. After the update_attributes, you could try calling sign_out first.

    sign_out(@user)
    sign_in(@user)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Artist conroller, edit method looks like this def edit @user = User.find(params[:id]) end
I have this method: scala> def foo(traversable: Traversable[{def toByte: Byte}]) = { | traversable.map(_.toByte)
I have a method in controller that receives a parameter like this: def example
I have a controller method that is a little something like this: def suggestions
Let's say that I have a method that looks like this: def raise_if_client_status_error(xml_resp) #
I have this method: + (MHTwitterParser*)createParser:(NSString*)format { if ([format compare:@json] == NSOrderedSame) { return
I have methods in all of my models that look like this: def formatted_start_date
I have a bunch of python methods that follow this pattern: def delete_session(guid): conn
I have this method (someone else wrote it!) - (IBAction)showMasterPopover:(id)sender { if (_hiddenPopoverController &&
I have this method that usually works, but lately it has been giving me

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.