C'è un really nice article che ho usato quando stava tramontando prima volta il AA+s3+Paperclip
.
Ha delle spiegazioni decenti + example app on Github, quindi è possibile controllarlo dal vivo.
In AA forma sarebbe simile a questa:
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
fonte
2014-12-26 14:46:59
http://blog.littleblimp.com/post/53942611764/direct-uploads-to-s3-with-rails-paperclip-and –