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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:08:01+00:00 2026-05-18T10:08:01+00:00

I have a web application I am working on with Rails 3 and I

  • 0

I have a web application I am working on with Rails 3 and I have just implemented some basic Vanity URL paths to existing resources in the application. What I am looking to do is to not have to explictly build the urls on the user’s profile page for the resources that are available, e.g. I would like to be able to build a URL with link_to in the view in the format of:

typealoud.com/:user_id/:thread_id/:comment_id

And not what the standard nested resource helpers give me, something like:

typealoud.com/threads/:thread_id/comments/:comment_id

Should I do this myself as a URL helper, or is there an existing gem?

  • 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-18T10:08:02+00:00Added an answer on May 18, 2026 at 10:08 am

    To do this, I would put this at the top of my routes:

    match ':user_id/:thread_id/:id', :to => "comments#show"
    

    I’ve changed comment_id in this example to id because it’s “The Rails Way” that the last id parameter is simply called id. It also results in shorter code.

    If you wish to have a routing helper for it use the :as option:

    match ':user_id/:thread_id/:id', :to => "comments#show", :as => "comment"
    

    Then you can use comment_path/comment_urlto access the route, but you must pass in three arguments to it, each of them being an object or an id of an object.

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

Sidebar

Related Questions

I have just been working on a C# file (Global.asax.cs) in a web application
I am working on a Spring web application where I have a need to
I have tried to upgrade my application from Rails 2.3.2 to Rails 2.3.5 on
I have a mvc web application, previously it was running, I don't know what
I have an MVC web application, the urls like following in my views\ folder:
I have created an web based application through which the users can change the
I'm working with a web application I built in ASP.NET MVC. It is deployed
I have Deployed my PHP web application on Amazon Cloud. I have installed PHP
I have following web-fragment.xml in a jar file, under META-INF/ It seems I cannot
Pardon me if this question sounds trivial, I don't have any experience working with

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.