Reputation: 1346
I have a group controller that manages groups, each group can have many users.
I want to retrieve the users using JSON but where should I put the logic and in what controller?
It's more a matter of what feels good, any suggestions?
Should I use something like /groups/1/users
or
/users/group/1
?
Upvotes: 0
Views: 36
Reputation: 15089
I believe there are two approaches to the problem. The RESTFUL one: /groups/1/users
, and the other would be passing params to the users
resource via GET: /users?group=1
Upvotes: 0
Reputation: 3338
/groups/1/users
is the Rails way to go, especially if you use nested resources (the logic for users goes into UsersController
naturally).
Upvotes: 1