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

Attachment adapters #3237

Merged
merged 4 commits into from
Jun 28, 2019
Merged

Conversation

elia
Copy link
Member

@elia elia commented Jun 21, 2019

Description

This PR has been extracted from #2974 as suggested by @kennyadsl

Paperclip has been officially deprecated and is no more maintained, but the supposed replacement with ActiveStorage is not possible to due to lack of proper support for public long-term urls.

This PR allows Image and Taxon to switch their attachment implementation, extracting Paperclip to a concern, and opening the door for alternative implementations (e.g. Carrierwave, Shrine, AttachmentFu, et cetera).

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)

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.
@elia elia force-pushed the elia/attachment-adapters branch from d5b7604 to d387a72 Compare June 21, 2019 16:08
@elia elia marked this pull request as ready for review June 21, 2019 16:25
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elia I think this is a great improvement, thank you!

I left one comment, it is blocking as I think there's a bug.

Also, I am thinking about whether it may be worth documenting the ability to change the image uploads gem within the guides, as this feature may have a strong appeal to many devs, what do you think?

Again, thank you for your continuous work in trying to improve Solidus image uploads 🖼

core/app/models/spree/image.rb Outdated Show resolved Hide resolved
@kennyadsl
Copy link
Member

I've tested this PR in a clean application that also has a custom definition of Spree::Image style:

# config/initializers/spree.rb

Spree::Image.attachment_definitions[:attachment][:styles] = {
  mini: '48x48>',
  small: '100x100>',
  product: '240x240>',
  large: '600x600>',
  mobile: '400x500>',
}

Everything works as expected but we need to fix what @spaghetticode spotted, thanks @elia !

@kennyadsl kennyadsl force-pushed the elia/attachment-adapters branch from d387a72 to 7205f46 Compare June 25, 2019 15:07
@spaghetticode spaghetticode self-requested a review June 25, 2019 21:06
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you @elia & @kennyadsl 🤝

Copy link
Contributor

@jacobherrington jacobherrington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Nice work @elia 👍

@kennyadsl kennyadsl force-pushed the elia/attachment-adapters branch from 7205f46 to 55abebe Compare June 26, 2019 07:59
@kennyadsl kennyadsl merged commit cab38a3 into solidusio:master Jun 28, 2019
@kennyadsl kennyadsl deleted the elia/attachment-adapters branch June 28, 2019 11:32
@filippoliverani filippoliverani mentioned this pull request Jan 31, 2020
3 tasks
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

Successfully merging this pull request may close these issues.

4 participants