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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:36:30+00:00 2026-06-05T03:36:30+00:00

I have a basic app in Rails 3.2 – two main controllers: users and

  • 0

I have a basic app in Rails 3.2 – two main controllers: users and articles.
The basic routing is like web.com/users/john and web.com/articles/articles-name.

With the match rule I can make the URLs above shorter:

match "u/:permalink" => "users#my_action_name"
match "a/:permalink" => "articles#my_action_name"

allow me to do
web.com/u/john and web.com/a/articles-name

But in the best way, I would like to make the URL yet shorter and more readable, like this (this way use for instance Twitter – twitter.com/username)
web.com/john and web.com/articles-name

But I can’t imagine, how to realize this way of routing. In the app are used also another controllers, like for example HomeController with actions index, about, contact.

  • 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-05T03:36:32+00:00Added an answer on June 5, 2026 at 3:36 am

    Take a look at the “Route Globbing” section of the official Rails guides. You need to add something like

    match '*users_or_articles' => 'agnostic#show'
    

    at the end of your config/routes.rb file. This will catch all request that found no matchers in your routes file so far. Then your controller has to identify what to do with the request.

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

Sidebar

Related Questions

I have created a very simple Rails 3.1 app with basic stuffs like following:
I have a pretty basic 'User' model, control & views for a Rails app.
Basic Information I have a rails app A that is connected to a mysql
I have a Rails app with some basic models. The website displays data retrieved
I have a basic web app in place: it has a registration page, a
I have a very basic rails app. I am playing around with validation. Controller
I have a fairly standard rails app and would like to be able to
I have created a very basic Rails 3.1 app, deployed to a box that
I have a basic iOS app that interfaces with a Rails app. The idea
I'm learning Android development. I have a basic app running on the Gingerbread emulator,

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.