How to add parent attributes inside its children in rabl template? To do something like this:
some_root_attr: {
attr_a: \'rgtr\',
parent: [
{
nesquena posted solution on github: https://github.com/nesquena/rabl/issues/436
collection @posts
node :categories do |p|
p.categories.map do |c|
partial("categories/show", :object => c).merge(:post_attr => p.post_attr)
end
end
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 tested