我想在葡萄中创建一个 post 方法,我想收集一次所有参数
目前我正在使用它
params do
requires :id, type: Integer, desc: "post id"
requires :title, type: String, desc: "Title"
end
post do
post = Post.new(:id => params[:id],:title => params[:tile])
end
谷歌搜索后我发现了类似的东西
params do
group :post do
requires :id, type: Integer, desc: "post id"
requires :title, type: String, desc: "Title"
end
end
post do
#post = Post.new(params[:post])
#post.save
end
but it is also asking for post hash
我也想上传文件(即添加文件的参数)