-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
ActiveStorage support #2974
ActiveStorage support #2974
Conversation
solidus_paperclip/lib/generators/solidus_paperclip/install/install_generator.rb
Outdated
Show resolved
Hide resolved
7a0b440
to
c93822c
Compare
Hey @elia, thank you for picking this up! I don't have the bandwidth right now to get this over the finish line; it's much appreciated to have you take a go at it. Feel free to send me an email or @ me if you have any questions, I'll try my best to help out. |
0eb9e0d
to
fe0e616
Compare
fe0e616
to
b710149
Compare
ff90227
to
7a375c8
Compare
b17e405
to
3928f90
Compare
0183b63
to
ba75f7f
Compare
ba75f7f
to
2b3bfc5
Compare
5eccbe5
to
cce8798
Compare
d214d9b
to
b131da3
Compare
@dankmitchell sorry for the delay, I rebased the branch, I hope to be back working on it by next Friday |
Update: we're going to put back paperclip as the default configuration for new apps, after that this PR will most likely be merged! 🎉 |
That’s a great decision @elia 💯 |
It's good practice not to define methods on Object, even if the method name was unique enough not to be in conflict with anything. Also changed the constant to reflect the actual content (Rails 5.2+) rather than a consequence of it, that allowed reusing it in more places.
ActiveStorage::Current.host must be set before every action dealing with AS URLs.
Only extracted the common stuff, leaving specific implementations in their specific modules.
Given the unresolved issues in the ActiveStorage implementation we keep Paperclip as the default strategy for new apps.
E.g. `.attachment(:mini)`.
This is necessary for `url_for` and other helpers to work.
8fb9ae5
to
3032e4a
Compare
I think that we cannot ship ActiveStorage support with the Rails issue mentioned above but I'd leave the possibility to use it for anyone that wants to switch at this stage. My suggestion is to:
What do you think? |
This sounds like a good plan 👍
|
Hi @elia and everyone working on this - thanks for your help! Question: If AS support isn't coming any time soon, is anyone working on bumping Paperclip to the latest version? The version of Paperclip that Solidus depends on is still one that needs aws-sdk 2.x for S3 support which is very out of date and I fear may not be patched if there are ever security advisories against it. |
@pedantic-git Hey there, thanks for pointing out this thing. Honestly, I'm not sure it's worth updating paperclip to a major version, now that ActiveStorage has support for public URLs merged, and will be released with Rails 6.1. We "just" have to create the new adapter. Also, |
@pedantic-git this should be resolved by #3438 |
Ah sorry, I think we were kinda locked on some old Paperclip version, if it's just about relaxing dependencies, I think it's something we should definitely do! |
@kennyadsl Looking forward to the merged version! I hadn't noticed that about 2.x still receiving updates, which is great news and puts my mind at ease for now. |
Closing, the work will keep going in #3501, I'll leave the branch there in case anyone is relying on it, thanks for picking up the slack @filippoliverani! |
📝 This is an attempt to resurrect the great work started by @swcraig (here and here) and building on the gallery API introduced in #2337
The old approach
After attempting to stay within the bounds of the old attempt I realized there was a problem with the fact that the gallery implementation wasn't really completed (several places still access images directly instead of going through the new API).
The new approach
The new approach is not to create an extension but rather extract all the Paperclip stuff to a concern and provide an alternative implementation based on ActiveStorage. That turned out to be way more clean and required way less code.
Migrating the assets and Paperclip/AS bridge
The nice thing is that it's also possible to offer a better migration path thanks to ActiveStorage mirroring. The idea is to create an ActiveStorage service based on the existing Paperclip storage that will serve the images from their current locations (e.g. S3 with the Paperclip defined folder structure) and have at the same time an AS mirror that points to the AS-S3 service. At this point new uploads would go to both service and there's plenty of time for a progressive migration of the assets base until the old service can be dismissed.
This will be part of a different PR, so this one won't be blocked and new installation can start with AS as soon as possible
🛣 Roadmap
Old roadmap (discarded)
setup the extension inside the repo making it a dependency of the main gemmove paperclip-related code piece by piece to the extensionadd an alternative ActiveStorage-based gallery implementation(maybe) add a specialized ActiveStorage service that can work with paperclip assets, to be as mirror serviceextract the extension to a different repoReference links
#gallery
toVariant
andProduct
#2337