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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T16:54:36+00:00 2026-06-08T16:54:36+00:00

I am having a product controller which allows me to access the show method

  • 0

I am having a product controller which allows me to access the show method in the usual rails way

product GET    /products/:id(.:format)                 products#show

Now, I would like to have a unique hash url for each product, which can be accessed at the root path e.g.
mydomain.com/24fe3455g

What would be the best way to do this?

Best
Philip

  • 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-06-08T16:54:37+00:00Added an answer on June 8, 2026 at 4:54 pm

    First of all, you need to define a matching route in your routes.rb. Since it kind of a “fall through” you would usually put it at the end of the routes. have a look at the guides for how to define that: http://guides.rubyonrails.org/routing.html

    if you want to always use this hash-style urls throughout your application instead of ids, you would also implement to_param and self.from_param methods in your model: http://apidock.com/rails/ActiveRecord/Base/to_param

    you could also use a gem like friendly_id if you like some tool support: http://rubydoc.info/github/norman/friendly_id/master/file/Guide.rdoc

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

Sidebar

Related Questions

Am having some products in my web service. I am getting the product name
I'm having problem with FS controller page template. I had this Plone2 base product
I'd like to do GET /Product/1 and DELETE /Product/1 instead of having to have
I am having many products with many categories which are associated with has_many using
I'm learning rails and trying to set up a product library where the products
i am having a product master table and various other tables containing properties of
We unfortunately find ourselves having to support our product in IE 6 because some
I'm having the following error returned when trying to index the product prices... 2012-03-16T17:05:57+00:00
I always seem to be having fun working with the Ax 2009 product until
I'm trying to create a basic shopping cart, having an issue with the product

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.