【发布时间】:2014-07-07 09:59:42
【问题描述】:
当我将 swagger 用于葡萄时,我可以描述复杂的参数:
参数[:by_commentable][:commentable_id] 参数[:by_commentable][:commentable_type]
desc "Get a list of comments"
params do
group :by_commentable do
requires :commentable_id, type: Integer, desc: "Filter by: Commentable object ID"
requires :commentable_type, type: String, desc: "Filter by: Commentable object type"
end
paginatable_params.call Comment
end
get "", http_codes: standard_responses do
apply_scopes(Comment.order_recent).page(params[:page]).per_page(params[:per_page])
end
end
end
如何在 Rails 中做同样的事情?
谢谢!
【问题讨论】:
标签: ruby-on-rails params swagger grape