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

Always set ActiveStorage::Current.host in base controllers #3613

Conversation

filippoliverani
Copy link
Contributor

@filippoliverani filippoliverani commented May 8, 2020

Description
Ref #3606

ActiveStorage disk service needs current host to be correctly set.
ActiveStorage::SetCurrent concern is not availabile in Rails < 6.0
so we need a custom one. The concern should always be included in
in controllers, there's no need to check if we are currently using
ActiveStorage based attachment adapters since Solidus already loads
ActiveStorage by default. This way we avoid loading uneccessary modules
during initialization process that could potentially conflict with
custom attachment adapters.

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)
  • [ ] I have attached screenshots to this PR for visual changes (if needed)

@filippoliverani filippoliverani force-pushed the filippoliverani/simplify-active-storage-checks branch from 71c53c8 to 270cd53 Compare May 12, 2020 07:06
@kennyadsl
Copy link
Member

@softr8 do you think this is ok to fix your issue?

@softr8
Copy link
Contributor

softr8 commented May 12, 2020

@softr8 do you think this is ok to fix your issue?

Yes!

Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

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

Thanks @filippoliverani! And thanks @softr8 for reporting!

🎉

@filippoliverani filippoliverani force-pushed the filippoliverani/simplify-active-storage-checks branch from 270cd53 to 8e67e75 Compare May 15, 2020 11:06
@filippoliverani filippoliverani changed the title Simplify checks to include ActiveStorage modules in controllers Alwasy include ActiveStorage::SetCurrent in base controllers May 15, 2020
@filippoliverani filippoliverani force-pushed the filippoliverani/simplify-active-storage-checks branch from 8e67e75 to 1e17f12 Compare May 15, 2020 12:30
ActiveStorage disk service needs current host to be correctly set.
ActiveStorage::SetCurrent concern is not availabile in Rails < 6.0
so we need a custom one. The concern should always be included in
in controllers, there's no need to check if we are currently using
ActiveStorage based attachment adapters since Solidus already loads
ActiveStorage by default. This way we avoid loading uneccessary modules
during initialization process that could potentially conflict with
custom attachment adapters.
@filippoliverani filippoliverani force-pushed the filippoliverani/simplify-active-storage-checks branch from 1e17f12 to 89be98c Compare May 15, 2020 14:03
@filippoliverani filippoliverani changed the title Alwasy include ActiveStorage::SetCurrent in base controllers Always set ActiveStorage::Current.host in base controllers May 15, 2020
@filippoliverani filippoliverani marked this pull request as ready for review May 15, 2020 14:45
@aldesantis aldesantis merged commit 7e26f00 into solidusio:master May 22, 2020
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.

None yet

4 participants