7

如果我有一个返回这个的函数:

render :json => @orders.as_json(include: [{:user => {only: :id}}], :only => [:id, :status_id])

我正在这样记录它:

 # @return [JSON] includes the id, the order status id and the id of the associated user

我想知道是否有更好的方法来记录返回的 JSON 的外观。

4

1 回答 1

-2

因此,如果您关心 API 的文档,我假设您也关心测试,因此您的 API 端点可能有测试。我建议您使用Rspec API Documentation。如果您当前没有使用 Rspec,我会尝试Apipie。这两种工具都将有助于确保您的 API 文档保持一致并保持最新。

于 2016-10-16T14:53:04.057 回答