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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:04:46+00:00 2026-06-13T13:04:46+00:00

I have a route that looks like match ‘solar_systems/:planet_num/:moon_num’ => ‘solar_system#moon’, :as => :moon

  • 0

I have a route that looks like

match 'solar_systems/:planet_num/:moon_num' => 'solar_system#moon', :as => :moon

I’d like to have a form with a select box for planet number and moon number and have it submit to this route. However I cannot use moon_path because it will have an error if the dynamic parameters are not included in it like this moon_path(4, 1). Is what I want even possible? If so, what do I give to the form tag for the route?

  • 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-13T13:04:47+00:00Added an answer on June 13, 2026 at 1:04 pm

    You don’t have to use the routing helper methods, and here you can’t since at the time of rendering your form you do not know the required parameters. You do, however, know the controller and action, which is really all that’s needed for the destination URL. So this should work:

    = form_tag('/solar_systems/moon') do
      = select_tag(:planet_num, ...
      = select_tag(:moon_num, ...
    

    This should render the form tag. To process the request, you will also have to add another route so the right controller action is called:

    match 'solar_systems#moon' => 'solar_system#moon', :via => :post
    

    Or, if it makes more sense in the context of your application, you could modify your existing route to make the parameters optional:

    match 'solar_systems(/:planet_num(/:moon_num')) => 'solar_system#moon', :as => :moon
    

    See this Rails guide for more details on non-resourceful routes.

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

Sidebar

Related Questions

I want to have a route that looks something like: www.abc.com/companyName/Controller/Action/Id However, all the
I have a route that is suppose to match something like this localhost:3000/site/admin and
I have a route that looks like the following: map.newsletter '/newsletter', :controller => newsletter
I have a route in my code that looks like this: map.app 'applications/:title_header', :controller
I have one route that looks like this: Router::connect('/Album/:slug/:id',array('controller' => 'albums', 'action' => 'photo'),array('pass'
I have a route that looks like this: SiteGameBundle_GameFinish: pattern: /game/finish defaults: { _controller:
Currently I have a route that looks like this: resources :posts I want to
I have a route that looks like this: new { controller = ControllerName, action
I have a route that looks like this (but I've tried a few different
I have a route in my asp.net mvc 2 site that looks like this

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.