'Understanding how nested routes work in Rails

I am a bit confused. This is my routes file:

enter image description here

When I try this, the link will not be as expected (cl is my checklist):

<%= page_checklist_path(cl) %>

The renders string of the link as:

/pages/31/checklists/4

But it should be

/pages/4/checklists/31

What is the problem here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source