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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:16:41+00:00 2026-06-03T06:16:41+00:00

When I create a user in my database, it also creates a unique identifier

  • 0

When I create a user in my database, it also creates a unique identifier string.

In my routes, I have:

match '/users/:unique_identifer', :to => 'users#show'

This part is working fine. When I go to /users/xyz, it brings me to the show action for the appropriate user.

However, when I try to update the user record, it redirect me back to /users/SOMENUMBER where SOMENUMBER is the user’s ID. This causes an error since the show action in the controller has:

def show
    @user = User.find_by_unique_identifier(params[:unique_identifer])
end

In other words, the show action is now only looking up the user by their unique identifier and not the user id.

The update action is as follows:

def update
    @user = User.find_by_unique_identifier(params[:unique_identifer])
    if @user == current_user && @user.update_attributes(params[:user])
      redirect_to @user
    else
      redirect_to @user
    end
 end

How do I get the update action to redirect to the user’s show action but with the appropriate link (/users/unique_identifier) instead of /users/ID?

  • 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-03T06:16:43+00:00Added an answer on June 3, 2026 at 6:16 am

    Try this

    redirect_to user_path(@user.unique_identifer)
    

    or

    redirect_to :action => :show, :unique_identifer => @user.unique_identifer
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a database called ADB. When I create a new user/role, that user
I have created one user named tuser with create database rights in SQL server
I would like to create the ASP.NET User database template on a database of
I created few user defined types in my database as below CREATE TYPE [dbo].[StringID]
Is it possible for a user other than root to create a database? GRANT
Consider this T-SQL: CREATE USER my_test_user WITHOUT LOGIN; SELECT USER_NAME(), USER, SUSER_SNAME(),SYSTEM_USER, suser_name(); EXECUTE
I've got a Users table with an Email column in my database. I've also
For deploying an application, I'm required to create a database for basic user authentication.
HI, I have a list of steps created by a user, in this list
I have a unique sql database setup in which I'm using nested sets to

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.