I want to create a post method in grape where i want to collect all the params once
currently I am using it like
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
after googling I found something like
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
I also want to file upload (i.e params to add file)