Reputation: 8649
Rails make It possible to map resources that are logically children of other resources In the URL for example
/magazines/:magazine_id/ads/:id show display a specific ad belonging to a specific magazine
Is it possible to do this In Play?
Upvotes: 3
Views: 924
Reputation: 2273
Yes, that is possible. It should look like this in your routes file:
GET /magazines/:magazine_id/ads/:id/show controllers.MyController.show(magazine_id: Long, id: Long)
And in your controller
public static Result show(Long magazine_id, Long id) {
...
}
Upvotes: 2
Reputation: 55798
Play doesn't care if arguments represents some kind of relation or not, it's job for your controller.
Of course it is possible to do that:
GET /some/:parent/:child controllers.Application.getRelated(parent: Long, child: Long)
in controller:
public static Result getRelated(Long parent, Long child) {
return ok(SomeFinder(parent,child));
}
Upvotes: 7