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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:49:59+00:00 2026-05-27T09:49:59+00:00

I am having trouble with some Ruby on Rails code. I have a data

  • 0

I am having trouble with some Ruby on Rails code. I have a data structure of nested resources (List has_many Tasks and a Task belongs_to a List). On my List.show page, I have the following line of code:

<td><%= link_to 'Show Task', list_tasks_path(@list, task) %></td>

The idea is that this page will link to a “show” page where I can view the details of an individual Task. I want the url to basically be

/lists/:list_id/tasks/:task_id

The problem is that the above code is directing me to

/lists/:list_id/tasks.task_id

on the index page of Task. How can I tell Rails to send me to the show page instead?

I have tried adding :action => show and :controller => tasks, as well as using show_list_tasks_path(@list, task). I also know that the structure itself is there because my show page works fine if I manually enter /lists/:list_id/tasks/:task_id.

Any help is appreciated. Thank you!

-Sum

  • 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-27T09:50:00+00:00Added an answer on May 27, 2026 at 9:50 am

    The problem here is that you’re using list_tasks_path when you should be using list_task_path.

    The list_tasks_path method will generate a URL to the index action, as you know already, and will make the second argument be the format for this request.

    For more information please read the Routing Guide.

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

Sidebar

Related Questions

I am having trouble converting some code from VB6 to VB.NET (I don't have
I've got some nested objects in rails. User -> has_many :tasks -> has_one :location.
I'm new to Ruby, so I'm having some trouble understanding this weird exception problem
Im having some trouble writing a getstring function, this is what I have so
Having trouble with some select statements. I have 2 tables. sms_log and sms_messages. sms_log
I'm having trouble understanding some web part communication code, and how to make it
I'm having some trouble setting up capybara (0.4.1.2) in a rails 2.3.8 app with
I was having some trouble running some Ruby scripts. While trying to get these
I am having trouble with some Ajax functionality. I have a single dropdown that
I am having some trouble finding a good answer to my question on rails

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.