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 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

I am just getting started with Ruby on Rails and i am not sure
I'm just getting started with rails gems, and wondering how best to add functionality
Just getting started with db2. Quick question about giving it SQL commands from a
I'm a relative rails newbie, just getting started on learning how to DRY my
just getting started with Rails, I would like to consume a webservice (using ActiveResource)
I've just migrated to rails 3.1 and I'm having trouble getting started with the
Hey all I just finished: http://www.mongodb.org/display/DOCS/Rails+3+-+Getting+Started#Rails3-GettingStarted-InstalltheRails3 But its not quite suited for ubuntu 10.04...
I'm just getting started with MongoDB and Mongoid for Rails and in need of
I'm just getting started with rails and ruby and i wanna start giving back
I'm just getting started with rails and I'm a little confused reading through different

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.