solidusio / solidus_auth_devise

🔑 Devise authentication for your Solidus store.
http://solidus.io
BSD 3-Clause "New" or "Revised" License
53 stars 128 forks source link

Fixes for Zeitwerk #176

Closed kennyadsl closed 4 years ago

kennyadsl commented 4 years ago

In production, we are experiencing issues with this extension and Zeitwerk, due to how it works and how we named filenames and classes (they should match). See #174

This PR fixes the issue by removing some deface overrides that are no longer needed (since they only apply to Solidus <= 2.5, currently EOL). Also, this PR reorganize some classes that use class_eval in favor of Module#prepend, which allows us to define a module that has the same name as the file.

A version bump will probably follow this PR.

aldesantis commented 4 years ago

@kennyadsl instead of making overrides compliant with Zeitwerk, I think we should simply prevent Zeitwerk from loading them in the first place:

config.eager_load_paths -= %W(#{config.root}/app/overrides)

Deface will still load them manually, so this won't create any problems. Furthermore, it's also what @fxn suggests to do (https://github.com/rails/rails/issues/36100#issuecomment-486927935).

kennyadsl commented 4 years ago

@aldesantis added the proposed solution directly into Deface with a fix: https://github.com/spree/deface/pull/202 which has now been released. I'll re-run specs here and we should be good to merge.