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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:12:02+00:00 2026-05-24T04:12:02+00:00

I am trying to make some clean URLs in a Rails3 application I am

  • 0

I am trying to make some clean URLs in a Rails3 application I am working on… but I am having a hard time understanding how to (or if I even should) customise my routes to make this work.

Here is the example:

I have a list of Stores. Each store is in a category (health, sports etc). Each store has a location.

I have 2 ways I’d like to present the data. One display is a list of all the stores in a directory type structure, the other is on a map.

Ideally I’d like my URLs to work something like this:

/stores/health/map (or /stores/map/health) to show just the health stores on a map (where essentially the map parameter is effecting which view is displayed, but still using the Index controller… which using a collection in my route doesn’t seem to suit)

The other URL I’d like is /stores/sports/ to show just the sports stores in a directory view (the default) for example…

I am not entirely clear how I can manipulate the routes to handle this…

Here is my current Route which isn’t really doing it for me:

resources :stores do
  collection do
    get 'map'
  end
end

On top of that, I’d like to be able to add filters without using ?query=params… so:

/stores/sports/hockey , would essentially filter out only hockey stores…

I have no issues doing this with ?query, it’s just putting my params into a nicer URL that I’m trying to achieve.

The documentation does not seem to outline what I am trying to do, so Im assuming what Im trying to do is wrong.

Is this breaking REST? Am I looking at it all backwards?

Thanks for your help, JD

  • 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-24T04:12:03+00:00Added an answer on May 24, 2026 at 4:12 am

    You might be overthinking this. 🙂

    If you want to route HTTP Get of ‘stores/health/map’ to the StoresController with an action name of, say, health_map, what you need to do is:

    get 'stores/health/map' => 'stores#health_map'
    

    Anything that is a clean URL and doesn’t modify data and uses HTTP GET is RESTful. (And that is coming from a co-author of a book on REST). It is when you wish to modify data that you need to be more careful on how you use methods.

    To do filtering, try something like:

    get '/stores/sports/:filter' => 'stores#sports'
    

    The value of the filter will come into your method as params[:filter]

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

Sidebar

Related Questions

I'm trying to make some social share buttons at my site, but the urls
I'm trying to make clean urls with php and im getting some errors. Hope
I'm trying to make some text bold using HTML, but I'm struggling to get
i'm trying to make some sort of Business Simulation Game and everything is working
I'm trying to make a clean maven setup on some legacy project that uses
I'm trying to make some communication for my PIC devices and I use UDP
I'm trying to make some kind of top for some game stadistics Table it's
I'm trying to make some utils for using with sqlite databases. For that I
I'm trying to make some sort of delay in the view controllers changing. I
I am trying to make some SPARQL queries using vc-db-1.rdf and q1.rq from ARQ

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.