Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently,
Spree::Config
,Spree::Backend::Config
etc. useSpree::Preferences::Configuration
class as a base. The problem withSpree::Preferences::Configuration
is that it persists every preference in the database, so that they can be e.g. changed via the UI in the admin panel.This causes some major issues with the initialization process. As an example,
Spree::Backend
defines a preference calledadmin_path
that's used to define the root for its routes. The value needs to be known at boot time, and cannot be dynamically changed. Similar case withSpree::Auth::Devise
, where certain Devise features are enabled at boot time, based on configuration.Because of that, we should introduce an additional type of Configuration - RuntimeConfiguration, that's not persisted and that should be only defined in an initializer. This will allow to run the configuration step before after_initialize, and will work regardless of whether the database connection is ready.
This PR implements a draft of such solution that could be later reused in other gems and extensions.