grape 图片api

时间:2014-05-16 07:58:31   收藏:0   阅读:348
 desc "Update image"
  params do
    requires :id,:type =>String,:desc =>"ID."
    requires :image,:type =>Rack::Multipart::UploadedFile,:desc =>"Image file."end
  post :image do
    new_file =ActionDispatch::Http::UploadedFile.new(params[:image])
    object =SomeObject.find(params[:id])
    object.image = new_file
    object.save
  end


链接地址 http://stackoverflow.com/questions/14067163/uploading-file-with-grape-and-paperclip

grape 图片api,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!