Nesting routing. That way, you can put the parent controller name in the URL. It is also possible to acquire the id information of another model with which it is associated. Nesting is recommended when you want to transition to individual pages.
resources :Parent controller do resources :Child controller end
Enclose the child controller in
do ~ end.
ex) ```ruby <% = link_to'chat room', class_room_messages_path (current_user.class_room.id)%>