Previously we only set these part-way through deployment, so the values could be out of sync between our ENV vars and Spree::Config (which itself is a mix of both cached values and database-persisted values).
- Storybook need to access through a GET method on `/rails/stories/**` served by `ViewComponent::Storybook::StoriesController`
- Configure exact policy with an initialized filter
This keeps the `OrderBalance` abstraction but removes the old code now
that the feature is enabled for all users in all instances and there are
no bugs reported. It's become dead code.
The initializer ran code the needs the database in the migrated state.
The decision is to not initialize anything relative to feature. This has to be done within the FlipperUI by the instance managers.
- Use the ActiveRecord adapter
- Use a middle to cache data through memoization (see https://github.com/jnunemaker/flipper/blob/master/docs/Optimization.md)
- Create the group `admins`: only user which are admins
- Create `unit_price` feature attached to `admins` group
- Add method `flipper_id` on User
This removes the deprecation warning:
```
[WARNING] The default currency will change from `USD` to `nil` in the
next major release. Make sure to set it explicitly using
`Money.default_currency=` to avoid potential issues
```
This removes the deprecation warning:
```
[WARNING] The default rounding mode will change from `ROUND_HALF_EVEN`
to `ROUND_HALF_UP` in the next major release. Set it explicitly using
`Money.rounding_mode=` to avoid potential problems.
```
by specifying the default rounding mode at boot time so that it's only
set once for the whole app. See
https://github.com/RubyMoney/money#rounding for details.
We set this value to `true` unconditionally in an initializer, and then check the value in various places via Spree::Config. It's never false, and it's not configurable, so we can just drop it and remove the related conditionals. 🔥
This will log any N+1 it finds, pointing to the line causing it and
a way to solve it, aka. which `#includes` to add. Like so
```
web_1 | GET /admin/order_cycles.json?ams_prefix=index&q%5Borders_close_at_gt%5D=Sun+Jan+31+2021+00:00:00+GMT%2B0100+(Central+European+Standard+Time)
web_1 | USE eager loading detected
web_1 | OrderCycle => [:coordinator]
web_1 | Add to your query: .includes([:coordinator])
web_1 | Call stack
web_1 | /usr/src/app/app/serializers/api/admin/index_order_cycle_serializer.rb:41:in `coordinator'
web_1 | /usr/src/app/app/controllers/spree/admin/base_controller.rb:98:in `render_as_json'
web_1 | /usr/src/app/app/controllers/admin/order_cycles_controller.rb:17:in `block (2 levels) in index'
web_1 | /usr/src/app/app/controllers/admin/order_cycles_controller.rb:14:in `index'
web_1 | bin/rails:4:in `require'
web_1 | bin/rails:4:in `<main>'
```
We gave a try at Bullet long ago and abandoned it because it's not
a silver bullet (pun intended) due to false positives. However, it's
pretty clear that this won't happen often; we have endless N+1 still to fix.
I recently experienced how, relying on Bullet made it just extra 30s to fix
additional N+1s other than the one I was fixing. Usually, finding the
culprit line takes me more of 30min.
The aim of this "feature toggle" is to enable the unit price display for each product/variants.
By default activate on both development and staging environment.
This enables toggling features as best fits us in each case. With this
new approach we can then toggle :customer_balance to an entire instance,
which is what we want in France.
It doesnt work in rails 5 and apparently it was introduced to debug already deleted products cache in staging
See this commit that introduced it 10a79d5a65
Spree used to give you more options to configure ActionMailer but our
setup is much simpler. We can remove unused code.
The removed option was never used by OFN and defaulted to true. We don't
need a database migration because the value isn't set in the database.