-
Notifications
You must be signed in to change notification settings - Fork 43
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
Unable to upload or display uploaded images when using UUIDs and Postgres #71
Comments
Ok i figured out part 1. The maglev migrations / active storage do not work with uuids For clarity, ive modified all the maglev migrations copied over to use uuids. This works fine now, uploads are fixed. It might be worth looking at the migrations and changing to use the orm id generator types like active storage does. |
But still failing to serve the uploaded images so digging into that. |
Ok well i had to patch Maglev::Asset to make this work, but theres probably a better way, would love some help.
|
hey @j-mcnally. sorry for being late in the game. Let me read everything :-) |
No worried @did appreciate you taking a peek for me. I have an unideal working solution, but feels like im hacking too much of the Maglev::Asset model, not really clear how its "supposed to work". |
The failing error on asset load was
|
Thanks for the clear explanation. I'm confused because Rails is supposed to take care of "friendly" urls by parsing ids (either integer based or UUID base). Hmm.. |
its likely some edge case with the "Friendly part" and "UUIDs" i noticed that if i pass anything other than a UUID to find, it auto nullls it out, likely something rails added for safety with UUIDs without considering how normal id lookups work. So unfortunately this feels like an upstream bug. |
I never really knew it worked this way. But look at this http://tutorials.jumpstartlab.com/topics/controllers/friendly-urls.html it appears the friendly thing works because of the way .to_i works
which explains why this works ints and not uuids if the find call is having the slug have .to_i called on it. My hottest take would be to use something other than find for the this one specific lookup use case and then allow it to be more safely overwritten with other id implementations. |
This article explains how UUIDs or non valid uuids are converted to nil |
I knew about the Actually, we need to 2 things to make Maglev support uuids.
|
in the meantime, I'm going to play with a new Maglev site and uuids. |
ActiveStorage handles this well i think, if you want to take a look
|
@did i really do appreciate you digging into this, hopefully things will continue to work well for me atleast in the meantime. Maglev seems awesome so far. |
@j-mcnally you're very welcome and thanks for taking the time to find a solution! |
hey @j-mcnally! |
this is great, the comprehensive support across models for uuids will be a win win i think for users. |
I've setup active_storage but uploads keep failing...
The text was updated successfully, but these errors were encountered: