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

Add warning about using UUIDs with activestorage #36562

Merged
merged 1 commit into from
Jul 24, 2019

Conversation

colszowka
Copy link
Contributor

Summary

When using ActiveStorage against models that have a UUID as their primary key the underlying attachment references are broken and random files get returned when fetching the attachment.

A question on stackoverflow that describes this problem in more detail can be found for example at https://stackoverflow.com/questions/51531441/rails-5-2-activestorage-with-uuids-on-postgresql

This PR just adds a warning / headsup comment on the corresponding guide.

Additionally I think it should be considered to file this as a bug, activestorage should never return seemingly random files potentially uploaded by other users due to this - instead I think it would make sense to raise an exception when trying to make the attachment against a model that has a different column type.

However, I think this tiny addition can already be helpful to users so I'd like to propose this addition, if I should also prepare a bug report for the more general issue please let me know.

Thanks!

@rails-bot rails-bot bot added the docs label Jun 27, 2019
@rafaelfranca rafaelfranca merged commit 96289cf into rails:master Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants