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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:30:42+00:00 2026-06-14T07:30:42+00:00

Is there a gem that does this or is it baked in even? My

  • 0

Is there a gem that does this or is it baked in even? My understanding of things now is that anytime I change the path for a page (perhaps I do it for SEO) I need to create a new 301 redirect. Shouldn’t this be handled automatically?

If so, how is it handled automatically and how do I make use of it?

Thanks!!!

  • 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-14T07:30:44+00:00Added an answer on June 14, 2026 at 7:30 am

    This is a rather complicated question and depends a lot on how your routes look right now. The simple answer is: no, this is not handled automatically by Rails.

    The easiest way to handle redirects like this is in the routes.rb file, redirect from the old path to the new one. Something like this:

    match '/products/:id', redirect("/new_products/%{id}")
    

    You can learn more about this kind of redirect at the Rails routing guide.

    If you’re changing just one instance of a product, then obviously this doesn’t make a whole lot of sense — you can’t do this for every changed object. In this case, we’ll assume that you aren’t using standard ID-based routing; if you were then this wouldn’t be a problem. (Since the ID wouldn’t change, instead it seems likely your routing is based off of a field that does change — like name or date or something.)

    In this case, you probably want to extract the routing field away from whatever it currently is and into a slug column of its own. I recommend the really excellent friendly_id gem for this: it allows you to automatically generate slugs, and its history module allows you to perform lookups with an object’s old slug.

    Then, you can look up an object by its ID, its slug, or any of its old slugs, if you find it necessary to do so.

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

Sidebar

Related Questions

I'm looking for a gem that does something like http://en.wikipedia.org/wiki/URL_normalization . Are there any
Is there a ruby gem that will format dates relative to the current time?
Is there a ruby gem or such for MySQL connection pooling that isn't part
If I come across old code that does if (!this) return; in an app,
I have created a gem that provides an executable. Now I'd like the users
I have a gem that does some tough numbercrunching: it crops interesting parts out
I'm writing a middleware that does something like this Given I am logged in
Is there a gem or a library to get ruby 1.9 methods like [1,
Is there a gem for threadpooling anyone can recommend?
Is there a gem in Ruby which can write to an Excel file, 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.