rails rabl multiple collections

radical_edo

I'm having a bit of trouble with rabl. This code

collection favourite_groups, root: :groups

extends 'favourites/base'

gives me the following json structure: { groups: [ {..}, {..} ] }. What I need is to append another node that contains an array - { groups: [ {..}, {..} ], users: [ {..}, {..} ] } The data is in separate variables, but it can be in one, which ever makes this work.

Ideas?

radical_edo

Ok, nevermind, made it work with this

object false

child favourite_groups => :groups do
  collection favourite_groups
  extends 'favourites/base'
end

child favourite_users => :users do
  collection favourite_users
  extends 'favourites/base'
end

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related