If I have nested resource routes, for example /building/1/floor/2/
room/
3 (building has_many floors and so on), I have to call the room_path
method like this:
But what I meant is, that you have to specify every single item in the
path of the url.
I think that in 80% of the use cases, nested resources are used to
indicate parenting in a tree-like data scheme.
Perhaps there could be a new option in the map.resource method that
could specify the foreign key to be used when generating a path or
url, so you just have to write
building_floor_room_path(room_id)
and the values for building_id and floor_id would be automatically
guessed out of the context.
Greets
Jonas
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.