Direct download of Rails on Amazon S3 using Activeadmin + Paperclip

I use Activeadmin and Paperclip to upload images to my Rails application. When I try to upload large files to S3, a timeout error occurs, so I have to implement direct upload to S3.

Does anyone know how I can do this? I could not figure it out ...

+7
ruby-on-rails amazon-s3 ruby-on-rails-4 paperclip activeadmin
source share
2 answers

There is a really good article . I used when I set up AA+s3+Paperclip for the first time.

This one has decent explanations + a sample application on Github , so you can check it live.

In AA, the form looks something like this:

 form multipart: true do |f| # f.semantic_errors *f.object.errors.keys f.inputs do f.input :image_name #or whatever field is called end f.has_many :attachments do |a| if a.object.persisted? link_to image_tag(a.object.encoded_url, class: 'image-preview'), a.object.encoded_url, target: "_blank" else a.inputs do a.s3_file_field(:attachment, as: :file, class: 'js-s3_file_field') end + a.inputs do a.input(:s3_url, as: :hidden, input_html: { class: "s3_url" }) end end end f.actions end 
+3
source share

The answer is presented in the comments. Thanks to Andrei for the link to the tutorial.

http://blog.littleblimp.com/post/53942611764/direct-uploads-to-s3-with-rails-paperclip-and

+1
source share

All Articles