0

I was following this guide for uploading images with PaperClip over ActiveAdmin: File upload with Activeadmin Rails using paperclip

Everything is working fine, but I was wondering, after I upload image, how to redirect it to be uploaded into /assets/images/ instead only in database?

Community
  • 1
  • 1
Michael
  • 199
  • 2
  • 16
  • Uploads will be saved in public folder, what's the point to put them in assets folder? – rmagnum2002 May 07 '14 at 12:11
  • Well i want to be able to upload it directly into /assets/ from ActiveAdmin, dont want them to be visible in public folder etc. any solutions/? – Michael May 07 '14 at 12:12
  • what do you mean by "instead only in database"? – Max Williams May 07 '14 at 13:57
  • well for now its only being uploaded into database(mysql) , and not anywhere else. cant find it either in public folder or assets(which are main question here, how to send image there) – Michael May 07 '14 at 14:17

1 Answers1

4

You don't.

It won't work anyway. assets/images is a source directory for rails asset pipeline. On your production server, the images are not used from there but from another folder where they have been updated by the pipeline (typically getting a name with a linked timestamp, so that the browsers can cache them properly).

To make this work you would need to upload them to the assets/images, then run again the asset pipeline, which would be... weird.

If you don't want to store them in the public folder, look at an external storage like S3 (sample using Heroku: https://devcenter.heroku.com/articles/paperclip-s3).

Martin
  • 7,634
  • 1
  • 20
  • 23