I have a User model that has many posts. Im trying to render the post in a rabl collection.
collection @posts
attributes :title, :created_at
The default rabl format for rendering json collections is
{'posts': ['post':{}, 'post':{}]}
. What I'm trying to accomplish is to change the 'post' key to a dynamic value post id for instance, so that my format would look like so {'posts':[1:{}, 2:{} ]}
. Was trying with the configure of Rabl but the only thing I found out is how to get rid of the collection key with
Rabl.configure do |config|
config.include_json_root = false
end