I have a collection of articles that I want to show in my json answer. I would also like to export node about a json type request.
index.json.rabl
collection @articles => :headlines
extends 'articles/show'
show.json.rabl
object @article
attributes :foo
So, going to the articles. json gives me:
{"headlines":[{"foo":thing1},{"foo":thing2}]}
What I would like to do is get the following results:
{"rss":{"name":"articles","woot":"what?"},
{"headlines":[{"foo":thing1},{"foo":thing2}]}
I tried putting node (: rss) {"yadda yadda"} in the index.json.rabl file, but this only adds node: rss to each article.
I tried to use
glue @article do
node(:rss) { "yadda yadda" }
end
both in the index and in the displayed file, and did not work as I hoped.
I have tried many other things, but at the moment I can only guess.
source
share