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

Unable to specify a custom attachment definition via config.taxon_attachment_module #3606

Closed
softr8 opened this issue May 4, 2020 · 2 comments

Comments

@softr8
Copy link
Contributor

softr8 commented May 4, 2020

With the combination of some extensions and the recent code merged that included support for ActiveStorage, it is no longer possible to specify a custom taxon attachment definition, the changes are in this commit d802e5b

For example, solidus_paypal_braintree gem has an initializer, that adds a custom helper that calls Solidus Payments Controller, which inherits from Admin Base Controller, which also inherits from BaseController, and it has the Spree::Config.active_storage_enabled? check, it compares the current taxon_attachment_module with ActiveStorages one, this initializer runs before any of my initializers including config/initializers/spree.rb, that's where I usually override default taxon_attachment_module to use my custom module, but it just sets the value but it was already loaded in taxon model

Steps to reproduce

  • Create a new solidus app with active storage changes included
  • Add solidus_paypal_braintree to gemfile
  • Create another taxon/paperclip_attachment with a custom method and add it to spree.rb initializer
  • Open rails console, find a taxon then try to call the custom method, it says undefined method since it loaded the default one instead of the custom one

Not sure how to fix it, maybe the most compatible one with current extensions ecosystem is to modify this check to not invoke the module?

What do you think?

@softr8 softr8 changed the title Unable to override config.taxon_attachment_module Unable to specify a custom attachment definition via config.taxon_attachment_module May 4, 2020
@kennyadsl
Copy link
Member

Yep, I think that active_storage_enabled? should not check the classes set to determine if we are using ActiveStorage, we can also be using it without using the modules provided by default in Solidus.

@filippoliverani can you please take a look next Friday? 🙏

@filippoliverani
Copy link
Contributor

Yep, I think that active_storage_enabled? should not check the classes set to determine if we are using ActiveStorage, we can also be using it without using the modules provided by default in Solidus.

@filippoliverani can you please take a look next Friday? 🙏

I agree, I'll update the check as soon as possible, thank you!

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

No branches or pull requests

3 participants