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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:25:29+00:00 2026-05-20T13:25:29+00:00

I am just getting started with Rails 3 and I do not quite understand

  • 0

I am just getting started with Rails 3 and I do not quite understand how to go about renaming routes.

What I want:

To rename the path to the users#show controller/action pair. So instead of the URL being www.example.com/users/show/1 it would just be www.example.com/1/home

In the future, I’d also like to be able to add additional paths onto the end such as:

www.example.com/1/home/profile/

How my user resources are set up:

resources :users, :except => [:destroy] do
  resources :favorites, :only => [:show, :update]
  resources :profiles, :only => [:show, :update]
end

What I tried:

match :home, :to => 'users#show' 

What happened:

ActiveRecord::RecordNotFound in UsersController#show

  Couldn't find User without an ID

What’s in the development.log file:

Started GET "/home" for 127.0.0.1 at 2011-03-10 13:36:15 -0500
  Processing by UsersController#show as HTML
  [1m[35mUser Load (1.6ms)[0m  SELECT "users".* FROM "users" WHERE ("users"."id" = 101) LIMIT 1
Completed   in 192ms

ActiveRecord::RecordNotFound (Couldn't find User without an ID):
  app/controllers/users_controller.rb:19:in `show'

What’s in the user controller:

def show
  @user = User.find(params[:id])

  respond_to do |format|
    format.html # show.html.haml
  end
end

So, apparently it is storing the user id, as shown in the development log as 101 but for whatever reason I am still getting this error?

Any help you can provide is greatly appreciated!

  • 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-20T13:25:30+00:00Added an answer on May 20, 2026 at 1:25 pm

    You should provide a segment key in your match:

    match ':id/home' => 'users#show'
    

    But with this renaming you will get not RESTful routes.

    Another thing is with user profiles. If one user can have only one profile it’s better to declare singular resource routes:

    resources :users do
      resource :profile
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sorry, if this is a noobish question, but I'm just getting started with Rails
Just getting started using MVC in ASP.NET, I'm going to have it so users
I am just getting started with flex and am using the SDK (not Flex
I'm just getting started with learning about Unit testing (and TDD in general). My
I'm just getting started with Ruby on Rails development and I have a question
I am just getting started learning rails. I am building my first app using
I'm just getting started with Ruby and Ruby on Rails, so excuse me if
I have trouble getting started with rails 3.0.0, because it just doesn't load the
So I'm getting started learning Rails. Now that Rails 3 is out, I want
Just getting started with Linq to SQL so forgive the newbie question. I'm trying

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.