solidusio-contrib / solidus_social

Building block for social authentication in your Solidus store.
BSD 3-Clause "New" or "Revised" License
27 stars 52 forks source link

Fix autoload warnings during initialization #98

Closed pelargir closed 1 week ago

pelargir commented 2 years ago

This fixes a deprecation warning about autoloading the Spree::SocialConfiguration constant during initialization. It also moves the config out of the Spree::SocialConfig constant and into a method while maintaining backwards compatibility per this suggestion.

Autoloading constants like Spree::SocialConfig during initialization will break in Rails 7.

This is the original warning:

DEPRECATION WARNING: Initialization autoloaded the constant Spree::SocialConfiguration.

Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.

Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload Spree::ReviewsConfiguration, for example,
the expected changes won't be reflected in that stale Class object.

These autoloaded constants have been unloaded.

Please, check the "Autoloading and Reloading Constants" guide for solutions.