-
-
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
Only default to activestorage adapter if Rails version is supported #4563
Conversation
Hey @tvdeyen. Can you help me understand from where this is coming? New stores won't start on Rails 6.0 and if I really correctly there were a deprecation message telling people to explicitly set that preference to Paperclip for existing stores. Just to understand if there's something I am missing, but of course the changes make sense! |
It makes sense, although I neither understand how it was a problem in new stores with the latest Rails. BTW, what about using https://github.com/solidusio/solidus/blob/master/core/lib/spree/rails_compatibility.rb to return the value? Having all the stuff that depends on Rails versions encapsulated will help to deprecate things while we move forward. |
@kennyadsl sure. This is a Rails 6.0 application, running Solidus 3.0. The initializer is set up like this: Rails.application.config.to_prepare do
Spree.config do |config|
[..]
config.image_attachment_module = "Spree::Image::PaperclipAttachment"
config.taxon_attachment_module = "Spree::Taxon::PaperclipAttachment"
end
end Trying to install the latest migrations via:
blows up with
What do you mean by that? We still support rails 5.2 and 6.0 in our Gemspec. |
@waiting-for-dev what do you mean by this comment? Do you agree with the change and I should try using that module instead? |
That's it 🙂 |
@waiting-for-dev thanks. Unfortunately the module is not available in Solidus 3.0 and this bug exists in Solidus 3.0 and above. Any ideas? |
Good point. What about using it only where it's available? |
2a93666
to
6e2fa1d
Compare
I didn't get that the issue was there when the migration runs, no matter what preference are you using. That's definitely a bug that we should address soon. Thanks! |
6e2fa1d
to
3caad8a
Compare
@waiting-for-dev done for |
3caad8a
to
1d86872
Compare
We only support the activestorage adapter with Rails 6.1 and above, but we default to it, even if the Rails version is 6.0 and below. Since we still support Rails 5.2 and 6.0, we cannot default to the active storage adapter. The app won't boot unless we also change the adapter in the spree initializer. If the initializer, though, is nested in a `config.to_prepare` hook (as recommended from Rails new autoloader zeitwerk [1]) the app refuses to start anyhow, because the config is then taken from the `app_configuration` defaults. [1](https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#use-case-1-during-boot-load-reloadable-code)
1d86872
to
8820577
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Summary
We only support the activestorage adapter with Rails 6.1 and above,
but we default to it, even if the Rails version is 6.0 and below.
Since we still support Rails 5.2 and 6.0, we cannot default to
the active storage adapter. The app won't boot unless we also
change the adapter in the spree initializer.
If the initializer, though, is nested in a
config.to_prepare
hook(as recommended from Rails new autoloader zeitwerk [1]) the app
refuses to start anyhow, because the config is then taken from
the
app_configuration
defaults.1
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs: