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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:38:00+00:00 2026-05-13T19:38:00+00:00

Is there a simpler way of writing this: map.old_site_cusom_packages ‘/customs_packages_options.html’, :controller => :public, :action

  • 0

Is there a simpler way of writing this:

  map.old_site_cusom_packages '/customs_packages_options.html', :controller => :public, :action => :redirect_to_home
  map.old_corporate '/corporate.html', :controller => :public, :action => :redirect_to_home
  map.old_track '/track.html', :controller => :public, :action => :redirect_to_home
  map.old_links '/links.html', :controller => :public, :action => :redirect_to_home
  map.old_contact '/contact.html', :controller => :public, :action => :redirect_to_home

I want to send many named routes to one action on one controller, I’m making sure url’s left over from an old site redirect to the correct pages.

Cheers.

  • 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-13T19:38:00+00:00Added an answer on May 13, 2026 at 7:38 pm

    You can always write a multi-purpose route with a regular expression to capture the details:

    old_content_names_regexp = Regexp.new(%w[
      customs_packages_options
      corporate
      track
      links
      contact
    ].join('|'))
    
    map.old_content '/:page_name.html',
      :controller => :public,
      :action => :redirect_to_home,
      :requirements => {
        :page_name => old_content_names_regexp
      }
    

    That should capture specific pages and redirect them accordingly. A more robust solution is to have some kind of lookup table in a database that is checked before serving any content or 404-type pages.

    Edit: For named routes, it’s an easy alteration:

    %w[
      customs_packages_options
      corporate
      track
      links
      contact
    ].each do |old_path|
      map.send(:"old_#{old_path}",
        "/#{old_path}.html",
        :controller => :public,
        :action => :redirect_to_home,
      )
    end
    

    In most cases the old routes can be rewritten using the singular legacy route listed first. It’s also best to keep the routing table as trim as possible. The second method is more of a crutch to try and bridge the old routes.

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

Sidebar

Related Questions

Is there a simpler way of implement this? Or a implemented method in JDK
Why is there an underscore for data_? Is there a simpler way of writing
Is there a relatively simple way in nant, without writing a custom task, to
Is there a simpler way to rewrite the following condition in JavaScript? if ((x
When you have a derived class, is there an simpler way to refer to
Is there a better/simpler way to find the number of images in a directory
It seems like there should be a simpler way than: import string s =
I was wonder if there is a simpler (single) way to calculate the remaining
Is there a simple way of getting a HTML textarea and an input type=text
[Preamble: Whereas I realize there may be simpler ways to do this (i.e., just

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.