Skip to content

Commit

Permalink
Document changes about how to configure sources for static preferences
Browse files Browse the repository at this point in the history
We rearrange the CHANGELOG to accommodate the increased amount of
information.
  • Loading branch information
waiting-for-dev committed Jul 15, 2022
1 parent 5ea8748 commit c9562c6
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

- Fix CSRF forgery protection bypass for Spree::OrdersController#populate [GHSA-h3fg-h5v3-vf8m](https://github.com/solidusio/solidus/security/advisories/GHSA-h3fg-h5v3-vf8m)

**Other important changes**
### Other important changes

#### No more autoload of decorators in fresh applications

New Solidus applications won't autoload files matching `app/**/*_decorator*.rb`
pattern anymore. For previous Solidus applications, it's something that will
Expand Down Expand Up @@ -43,7 +45,7 @@ of Solidus recommendations (that files are monkey patches; they don't use the
you can place those files in `app/overrides/` and remove the `decorator`
suffix.

### Changes to the promotion system
#### Changes to the promotion system

Promotions with a `match_policy` of `any` are deprecated. If you have promotions
with such a match policy, try running the following rake task:
Expand All @@ -64,6 +66,43 @@ set a temporary flag in your `config/initializers/spree.rb` file:
config.allow_promotions_any_match_policy = true
```

#### Static preference sources configured within `.to_prepare` blocks

[Rails 7 no longer supports referring autoloadable classes within an
initializer](https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoload-on-boot-and-on-each-reload).

Because of that, we need to change the way we configure static preference sources.

Before:

```ruby
# config/initializers/spree.rb
Spree.config do |config|
config.static_model_preferences.add(
AmazingStore::AmazingPaymentMethod,
'amazing_payment_method_credentials',
credentials: ENV['AMAZING_PAYMENT_METHOD_CREDENTIALS'],
server: Rails.env.production? ? 'production' : 'test',
test_mode: !Rails.env.production?
)
end
```

Now:

```ruby
# config/initializers/spree.rb
Rails.application.config.to_prepare do
Spree::Config.static_model_preferences.add(
AmazingStore::AmazingPaymentMethod,
'amazing_payment_method_credentials',
credentials: ENV['AMAZING_PAYMENT_METHOD_CREDENTIALS'],
server: Rails.env.production? ? 'production' : 'test',
test_mode: !Rails.env.production?
)
end
```

### Core

- Add configuration option for `migration_path` [#4190](https://github.com/solidusio/solidus/pull/4190) ([SuperGoodSoft](https://github.com/supergoodsoft/))
Expand Down

0 comments on commit c9562c6

Please sign in to comment.