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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:08:44+00:00 2026-05-29T20:08:44+00:00

In my Rails 3.2 application, there is an Exercise model with attributes muscle_group and

  • 0

In my Rails 3.2 application, there is an Exercise model with attributes muscle_group and grade_level. I’ve defined the following route with dynamic segments for it in config/routes.rb:

# config/routes.rb
match "/:muscle_group/grade-:grade_level/:id" => "exercises#show"

Running bundle exec rake routes confirms that the route does indeed exist:

/:muscle_group/grade-:grade_level/:id(.:format) exercises#show

The database contains an Exercise record with:

  • id = 5
  • muscle_group = “abdominal”
  • grade_level = 1

And yet when I point my browser to http://localhost:3000/abdominal/grade-1/5, I get:

Routing Error
No route matches [GET] "/abdominal/grade-1/5"
Try running rake routes for more information on available routes.

How can I get this route with dynamic segments to work?

  • 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-29T20:08:45+00:00Added an answer on May 29, 2026 at 8:08 pm

    The route declaration I was using was almost functional. For some reason there is an issue with using a hyphen and not having grade_level as its own /-separated substring. When I switched to using the route declaration:

    match "/:muscle_group/grade/:grade_level/:id" => "exercises#show"
    

    Instead of the original:

    match "/:muscle_group/grade-:grade_level/:id" => "exercises#show"
    

    http://localhost:3000/abdominal/grade/1/5 is then a valid route.

    I would prefer to have this route with the hyphen and wish I knew how to make that work, but it is not a top priority. If anyone knows how to make it work with the hyphen, please let me know.

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

Sidebar

Related Questions

In my Rails application there is a model that has some has_one associations (this
I have an rails 3 application where there are multiple registrations (diagnosis, patient, laboratory
If there's an exception in a Rails application, one gets an error page with
Is there an equivalent of htmlspecialchars_decode (PHP) in Ruby (for a Ruby-on-Rails application) Or
in my rails 3 application, there is a select_tag with an onchange event, which
In my Rails application there are some metrics about the content of the database
i am creating a rails application and there is a part that is causing
My Rails application have a User model and a Group model, where User belongs
is there a sample rails application that uses a sign on with google approach?
Is there a PubNub example application built on Rails out there? I'm having a

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.