Open dbishai opened 5 years ago
Is the attachment part of the Post schema? If so, I think you have to create the Post first so that it has an :id. WIthout an :id field, the attachment name generation will not work.
E.g., if the Post is going to have an id == 4, but it has not been created yet, instead of an attachment 4_myimage.png you will get _myimage.png.
(I think this is correct. Still new to it myself.)
Well it's an attachment on the Item schema which belongs to the Post context, but yes. I assumed it would create the record first, then generate the name and upload using some after_create
hook. It's looking like this is not the case.
@dbishai I assume this issue is related to arc_ecto
and not arc
itself?
https://www.reddit.com/r/elixir/comments/5yo4ui/ecto_lack_of_callbacks_the_pain/
Environment
Expected behavior
Attachment will be uploaded to S3 when object is created with an empty changeset and set of attributes.
Actual behavior
Attachment is not uploaded until object is updated.
As stated above, if I create a new record with an attachment, the attachment is not uploaded to S3 until I update the record.
This works:
This does not:
posts.ex