Save files using paperclip via API

后端 未结 1 644
广开言路
广开言路 2021-02-09 16:44

I\'m using paperclip to manage uploads, backed onto S3 via Fog. It works well.

I\'m trying to take attachments out of emails and save them via paperclip (using the same

相关标签:
1条回答
  • 2021-02-09 16:53

    If you already have the UploadedFile, you can just set the virtual attribute Paperclip gives you to that.

    So, if you had a params[:file], and a model with has_attached_file :file, you should be able to just do @obj.file = params[:file]; @obj.save.

    0 讨论(0)
提交回复
热议问题