fabrik42/acts_as_api — Issue #48: Render two arrays of objects from same model in groups
Author: smartcode
Created: 2011-12-06 11:40:58+00:00
State: open

Hello

I already searched trough the wiki but i didn't find a solution.

I have two arrays / ActiveRecord relations which contain objects from the same model which has
api_accessible :name do |t|
t.add :id
t.add :first_name
t.add :last_name
end

The arrays represent two groups of different users
and i want to render them in one JSON object which contains both of the arrays like
-{
- group_1 : [
{..},
users of group_1 rendered over acts_as_api
],
- group_2 : [
{..},
users of group_2 rendered over acts_as_api
]
}

Can i realize this using acts_as_api?
Tanks for your help!