How to add parent attributes inside its children in rabl template? To do something like this:
parent: {
attr_1: 'asd',
attr_2: 'dfg',
child: {
attr_3: 6,
attr_from_parent: 'cvb'
}
}
How to add parent attributes inside its children in rabl template? To do something like this:
parent: {
attr_1: 'asd',
attr_2: 'dfg',
child: {
attr_3: 6,
attr_from_parent: 'cvb'
}
}
object @parent
attributes :attr_1, :attr_2
child :child do
attributes :attr_3, :name
node(:attr_from_parent) { @parent.attr_from_parent }
end
You may also have a look at http://railscasts.com/episodes/322-rabl?view=asciicast