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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T22:59:37+00:00 2026-05-21T22:59:37+00:00

In the Rails Guides under 2.5 Singular Resources , it states Sometimes, you have

  • 0

In the Rails Guides under 2.5 Singular Resources, it states

Sometimes, you have a resource that
clients always look up without
referencing an ID. For example, you
would like /profile to always show the
profile of the currently logged in
user. In this case, you can use a
singular resource to map /profile
(rather than /profile/:id) to the show
action.

So I tried the example:

match "profile" => "users#show"

However, when I attempt to go to the profile_path, it attempts to redirect to the following, where id = :id:

/profile.id

This represents two issues:

  1. I dont want the id to be displayed at all, and thought this was a routing pattern to mask an id
  2. Using this method causes the following error. It also causes this error when I attempt to request user_path.

Error:

ActiveRecord::RecordNotFound in UsersController#show

Couldn't find User without an ID

I guess this is because the params being passed through look like this:

{"controller"=>"users", "action"=>"show", "format"=>"76"}

Am I using singular resources correctly?

My UsersController:

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

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @user }
    end
  end

My routes:

  resources :users
  match "profile"  => "users#show"
  • 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-21T22:59:38+00:00Added an answer on May 21, 2026 at 10:59 pm

    Or

    get "/profile/:id" => "users#show", :as => :profile
    # or for current_user
    get "/profile" => "users#show", :as => :profile
    

    or

    resource :profile, :controller => :users, :only => :show
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Rails make It possible to map resources that are logically children of other resources
Rails has a nice idiom that makes it easy for you to have a
In the Rails guides they have this code to load a path. $LOAD_PATH <<
I'm reading these two pages resources Adding more RESTful actions The Rails Guides page
Anyone knows if there are any framework or layout that use the Rails Guides
I have a rather complicated (to me) statements to write in Rails. Under the
I saw in rails guides that, mentioning foreign key in model doesn't really create
I am following this routing tutorial for Ruby on Rails: http://guides.rubyonrails.org/routing.html It says that
On the topic of the asset pipeline, Rails Guides suggest that Rails can link
I have looked through the Ruby on Rails guides and I can't seem 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.