Providing scores in rabl

I use RABL to format the output of the Rails API. I tried the following code

message.rabl:

object @message attributes :id,:description,:created_at,:created_by_user_id child @comments do |t| partial("user/comment", :object => @comments) end 

comments.rabl:

 object @comments attributes :comment_body 

My problem is that my message.rabl is not rendering partial ie .rabl comments. What is the correct way to render in rabl. Thanks.

+4
source share
1 answer

You were close, and this is a bit confusing, but use extensions instead of partial ones instead:

 child @comments do |t| extends "user/comment" end 

and you should be good to go. See https://github.com/nesquena/rabl/issues/58 for more details.

+10
source

All Articles