Adam O'Connor
Adam O'Connor

Reputation: 2652

How to use ORM (activerecord) with Carrierwave_direct?

I'm successfully using Carrierwave_direct - it mounts an uploader and uploads directly to S3 yay! H

owever, unlike Carrierwave it does not persist a record into the DB - rather it just redirects back to a 'success_path' (standard AWS/S3 function).

Before embarking on rolling my own solution I'm curious if anyone has figured this out or has a good approach for this. I would like it to upload directly to S3 and use carrierwave to persist the record to the db.

My immediate thoughts are to pass params to the process which get carried back to the app - then grap these params and create the record.

Appreciate any thoughts.

Upvotes: 1

Views: 294

Answers (1)

ndemoreau
ndemoreau

Reputation: 3869

All you have to do is:

  • giving the page you want to go back on success in the new action of your controller: @uploader.success_action_redirect = 'Your_update_page'
  • Amazon will bring you back to this page on success and add a 'key' argument in which you will have the information you need to update the db.

This is very well explained on the github readme of carrierwave direct.

Upvotes: 1

Related Questions