Home>

We are currently creating a ToDo application with a personal application. The task is nested in the list, and the link to the detail page of the task is
It's supposed to be funny. Originally, I want to say "/lists/1/tasks/1", but "/lists/1/tasks.1" and the link destination are displayed. The argument of link_to was reversed yesterday, but it is a normal link destination. When rails is launched today, such a phenomenon occurs.

I want to cure a strange link

Today's link Link of yesterday Applicable source code

Excerpts that seem to have a relationship
tasks_controller.rb

def show
    @task = @list.tasks.find(params[:task_id])
  end


lists/index


  
  <% @lists.each do |list| %>
      ~abridgement~
    <% list.tasks.each do |task| %>
      
        
        <%= task.title %>
        <%= link_to list_tasks_path(list.id, task.id), method: :get do %>
        <i></i>
        <% end %>
        
      
    <% end %>
  <% end %>
      
    
  
What I tried

I wonder if the argument is wrong,

<%= link_to list_tasks_path(list.id, task.id), method: :get do %>


When I tried to list.tasks.ids, I found a destination I didn't quite understand like list/1%2F2%2F3%2F4%2F5%2F6%2F7%2F8/tasks.1.

Supplementary information (FW/tool ​​version, etc.)
  • Answer # 1

    list_tasks_pathNot
    list_task_pathWhat about?

Related articles