Use through-relation instead of manually mapping.

This commit is contained in:
Douwe Maan 2015-04-10 14:40:26 +02:00
parent ff3caad4ca
commit e6569defe6

View file

@ -9,8 +9,7 @@ module API
# GET /groups/:id/members
get ":id/members" do
group = find_group(params[:id])
members = group.group_members
users = (paginate members).collect(&:user)
users = group.users
present users, with: Entities::GroupMember, group: group
end