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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T16:10:36+00:00 2026-05-11T16:10:36+00:00

My application currently has a very simple URL layout: map.resource :account, :controller => users,

  • 0

My application currently has a very simple URL layout:

map.resource  :account, :controller => "users", :only => [:show, :update, :destroy] 
map.resources :workouts do |workout|
  workout.resource  :chart, :only => [:show]
  workout.resources :taggings, :only => [:destroy, :create]
end

Giving me nice easy urls for the current user.
I’m now adding some public features – the ability for the public to see items. I’d like to prepend a user’s login name to these URLs. At the same time, there’s no need for public users to have access to anything besides the one workout resource. I’m not sure the best way to do this. I’d like to wind up with URLs that look like:

/teich/workouts/3454

Which is roughly

/:user_login/workouts/:id

Do I path_prepend? For the current user, who wants the full RESTful controls, is it best practice to still have their username prepend instead of direct URLs as I have now? Do I not worry abut all the extra routes with the path_prepend since I’ll be :before permission checking anyway?

  • 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-11T16:10:36+00:00Added an answer on May 11, 2026 at 4:10 pm

    Probably the easiest way to acheive something like this is to override to_param in your User model.

      def to_param
        "#{id}-#{login}"
      end
    

    Rails uses this method when generating paths for the model. Then, when doing finds the string sends to_i which will grab the integer.

    Don’t forget you’ll need to escape non-valid url characters too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 201k
  • Answers 202k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yay! I created my first Class! :D hehehehe... Here's the… May 12, 2026 at 8:16 pm
  • Editorial Team
    Editorial Team added an answer Basically via SendMessage or PostMessage. If you want to simulate… May 12, 2026 at 8:16 pm
  • Editorial Team
    Editorial Team added an answer Using whatever date formation you've established, parse the value of… May 12, 2026 at 8:16 pm

Related Questions

I use SQL Server 2005. I have a simple logging table that my web
I have a very simple application which currently has a single Linq to Sql
I've just started building a prototype application in Django. I started out by working
My employer has a database committee and we've been discussing different platforms. Thus far

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.