spree / deface

Rails plugin that allows you to customize ERB views in a Rails application without editing the underlying view.
MIT License
517 stars 128 forks source link

Tell Zeitwerk to ignore `app/overrides` in Rails 6 #202

Closed aldesantis closed 4 years ago

aldesantis commented 4 years ago

Currently, Ruby overrides (app/overrides/*.rb) don't work properly with Rails 6 and Zeitwerk, because Zeitwerk expects each Ruby file under app (or any other autoloaded path) to define its corresponding constant. With this patch, we tell Zeitwerk to ignore app/overrides in all Railties.

Removing these paths from eager_load_paths, as Deface is currently doing, is not enough, because Zeitwerk will still ensure that each file under an autoloaded path follows its conventions (see how it overrides Kernel#require).

aldesantis commented 4 years ago

@damianlegawiec I believe this is now ready. The existing initializer didn't account for the fact that Zeitwerk will still run its check when we require the files in app/overrides, unless we explicitly tell it to ignore that directory.

damianlegawiec commented 4 years ago

Thank you @aldesantis 👍

kennyadsl commented 4 years ago

Hey there! 👋 Is there any plan to release a new Deface version with this fix?