Is it possible to have such a case in phoenix or which is the best way to structure this
resources "/landlords", LandlordController do
resources "/houses", HouseController do
resources "/units", UnitController
end
end
Is it possible to have such a case in phoenix or which is the best way to structure this
resources "/landlords", LandlordController do
resources "/houses", HouseController do
resources "/units", UnitController
end
end
Yes it is possible, but it is not recommended to have too much levels of nesting.
What You could do is… break into smaller nesting.
resources "/landlords", LandlordController do
resources "/houses", HouseController
end
resources "/houses", HouseController do
resources "/units", UnitController
end
Or use composite object, eg, treat house and units together, and use nested forms.
resources "/houses", HouseController do
resources "/units", UnitController
end
Yeah this worked though i had tried before asking and i had errors. but now it worked