solidusio / solidus_support

Common runtime helpers for Solidus extensions.
BSD 3-Clause "New" or "Revised" License
9 stars 23 forks source link

Add lib/controllers/ENGINE to the autoload_paths #78

Closed DanielePalombo closed 1 year ago

DanielePalombo commented 1 year ago

Summary

SolidusSupport added lib/decorators/#{engine} to the autoload_paths, but there are no other autoloaded_paths for lib. This is a problem when the decorator tries to decorate an existing class, because it's not loaded yet.

A real example, happened on solidus_social, because it decorates a controller defined on solidus_auth_devise.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

DanielePalombo commented 1 year ago

@elia, this is the ticket we have investigated today.

kennyadsl commented 1 year ago

@DanielePalombo I'm not sure to understand the problem: are you decorating a controller that has been defined in the same engine? I'm sure I'm missing something, can you make a rough example?

elia commented 1 year ago

@kennyadsl as a result of the investigation we discovered that with Rails 5.2 and Solidus 3 the RegistrationController defined by solidus_auth_devise was not autoloaded correctly and another extension (solidus_social) attempting to decorate that controller was not finding it.

The decorator paths were added to the autoload paths here but the same wasn't done for lib/controllers.

kennyadsl commented 1 year ago

Ah, so, so we are talking about decorating controllers defined in other extensions, which are not autoloaded, makes sense now!

DanielePalombo commented 1 year ago

Thank you @elia for the explaination

kennyadsl commented 1 year ago

Merged, do we need a new version released?

DanielePalombo commented 1 year ago

Yes, please!

kennyadsl commented 1 year ago

@DanielePalombo @elia done!