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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:39:29+00:00 2026-06-02T09:39:29+00:00

i have a template url called /monsters. and in the template, i have a

  • 0

i have a template url called /monsters. and in the template, i have a sidebar

Sort by Type:

  • Water
  • Fire
  • Earth
  • Flying
  • etc…

i was wondering what was the best way to route each of those? im guessing it would be good to have the urls such as

www.example.com/monsters/water 

or

www.example.com/monsters/fire.

how should i go about doing that? on my routes.rb i thought of

match 'monsters/water',     to: 'monsters#water'
match 'monsters/fire',      to: 'monsters#fire'
match 'monsters/earth',     to: 'monsters#earth'
match 'monsters/flying',    to: 'monsters#flying'

etc…

but i feel like thats not a good way of doing. having a separate match going to a different action every time? could someone help me with the design? thorough and clear help would be much appreciated = )

thanks a bunch = )

or should i even be having separate links to begin with? should i be posting everything to my index action? i thought of using a form and using :post but thats already taken by my create action for monsters. currently on my index page (/monsters) its listing all of them because in my index action, i just do a

@monsters = Monster.paginate(page: params[:page])
  • 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-02T09:39:30+00:00Added an answer on June 2, 2026 at 9:39 am

    What you need is:

    resources :monsters, path: '/monsters/:category'
    

    This will generate these routes:

    named path   | verb   | route                                  | controller#action
                 |        |                                        |
    monsters     | GET    | /monsters/:category(.:format)          | monsters#index
    monsters     | POST   | /monsters/:category(.:format)          | monsters#create
    new_monster  | GET    | /monsters/:category/new(.:format)      | monsters#new
    edit_monster | GET    | /monsters/:category/:id/edit(.:format) | monsters#edit
    monster      | GET    | /monsters/:category/:id(.:format)      | monsters#show
    monster      | PUT    | /monsters/:category/:id(.:format)      | monsters#update
    monster      | DELETE | /monsters/:category/:id(.:format)      | monsters#destroy
    

    And it will allow you to do things like:

    /monsters/fire  => { controller: 'monsters', action: 'index', category: 'fire' }
    /monsters/water => { controller: 'monsters', action: 'index', category: 'water' }
    /monsters/earth/15 => { controller: 'monsters', action: 'show', category: 'earth', id: 15 }
    

    Plus, you can still use named paths:

    monsters_path('flying') => '/monsters/flying'
    edit_monster_path('fire', 15) => '/monsters/fire/15'
    

    And link to monsters like:

    <%= link_to monster.name, monster_path(monster.category, monster.id) -%>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this link in a template: <a href={% url show_item item.id %}>Item 1</a>
I have a template class, called OneCell , here the definition: template <class T>
I made a customized template called node-mynode.tpl.php Whenever a node of type mynode is
Is it possible in EE2 to have 2 URL's to map to a template
So I have a simple template problem. In a URL view I pass one
i have the following javascript in my view: $.ajax({ url:<?php echo site_url('switches/showknownvlans/'.$ip.'/'.$hardwaremodel);?>, type:'POST', dataType:'json',
I currently have a Content Type called News which is very simple (No custom
I have this at the top of the getjson url if(isset($_GET['template']) && $_GET['template']==blue) {
I have a function called get_header() which includes the header file in a template
I have this from tinymce and i called it before calling jquery.. <script type=text/javascript

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.