【发布时间】:2019-07-18 21:52:17
【问题描述】:
我想知道是否可以在使用 AMS 的括号中渲染不带参数的变量?
例如:
render json: { comments: @comments, status: 200, hasMore: hasMore }
这样
render json: @comments, hasMore: hasMore, include: ['user', 'replies.**']
没有在 json 上显示 hasMore
【问题讨论】:
-
那行不通。您需要构建一个 json 类型的对象才能正确呈现它。
标签: ruby-on-rails ruby ruby-on-rails-5 active-model-serializers