Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMP file url instead of AWS storage url, after migration from 1.3.1 to 2.0.1 #2421

Closed
AleksandrLeontev opened this issue Sep 13, 2019 · 4 comments

Comments

@AleksandrLeontev
Copy link

AleksandrLeontev commented Sep 13, 2019

I save Message model with nested Attachment model via accepts_nested_attributes_for and everything works on 1.3.1
When I migrate to 2.0.1 in general everything work, except one moment:
First time server return tmp path instead of absolute file path to AWS.
When I try to check attachment url via rails console or reload the page it works, but right after first upload uploader start return tmp file with 2.0.1 version

@mshibuya
Copy link
Member

Can I take a look at your uploader code?

@AleksandrLeontev
Copy link
Author

image
image
image

@mshibuya
Copy link
Member

Sorry for getting back late.

but right after first upload uploader start return tmp file with 2.0.1 version

How and when do you obtain the attachment url? Could you provide a code snippet?

@mshibuya
Copy link
Member

I suppose this is because of #2209, which defers the timing of storing attachments to after_commit phase.
Version 3.0 comes with #2546 that restores the timing to after_save. Or if you need to stay on 2.x, you need to hook into after_commit to obtain a stored URL, not cached one.

@mshibuya mshibuya closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants