How to add parent attributes inside its children in rabl template (when parent is an array)?
- 阅读更多 关于 How to add parent attributes inside its children in rabl template (when parent is an array)?
How to add parent attributes inside its children in rabl template? To do something like this: some_root_attr: { attr_a: 'rgtr', parent: [ { attr_1: 'asd', child: { attr_3: 6, attr_from_parent_array_member: 'cvb' } }, { attr_1: 'ert', child: { attr_3: 9, attr_from_parent_array_member: 'erty' } }, ... ] } How to get parent array member inside parent array member's child? object @obj attributes :attr_a child :parents do attributes :attr_1 parent = root_object.dup child :child do attributes :attr_3 node(:attr_from_parent_array_member) { parent.attr_from_parent_array_member } end end NB haven't