This (should) considerably improve traces like
https://app.datadoghq.com/apm/trace/917632173599137280?spanID=3163385094622710144&env=production&sort=time&colorBy=service&spanViewType=metadata&graphType=flamegraph&shouldShowLegend=true
by fixing the following 3 N+1s
```
user: root
GET /admin/customers.json?enterprise_id=4
USE eager loading detected
Customer => [:enterprise]
Add to your query: .includes([:enterprise])
Call stack
/usr/src/app/app/serializers/api/admin/customer_with_calculated_balance_serializer.rb:24:in `balance_value'
/usr/src/app/app/serializers/api/admin/customer_with_calculated_balance_serializer.rb:9:in `balance'
/usr/src/app/app/controllers/admin/customers_controller.rb:20:in `block (2 levels) in index'
/usr/src/app/app/controllers/admin/customers_controller.rb:17:in `index'
user: root
GET /admin/customers.json?enterprise_id=4
USE eager loading detected
Spree::Address => [:state]
Add to your query: .includes([:state])
Call stack
/usr/src/app/app/serializers/api/address_serializer.rb:14:in `state_name'
/usr/src/app/app/controllers/admin/customers_controller.rb:20:in `block (2 levels) in index'
/usr/src/app/app/controllers/admin/customers_controller.rb:17:in `index'
user: root
GET /admin/customers.json?enterprise_id=4
USE eager loading detected
Spree::Address => [:country]
Add to your query: .includes([:country])
Call stack
/usr/src/app/app/serializers/api/address_serializer.rb:10:in `country_name'
/usr/src/app/app/controllers/admin/customers_controller.rb:20:in `block (2 levels) in index'
/usr/src/app/app/controllers/admin/customers_controller.rb:17:in `index'
```
This popped up after improving the balances calculation. Now, that it's
fast, it's clear that are more performance problems on that endpoint.
We'll see if there are any left after this.
Where the presence of an object is being validated and that object comes from an *association*, we should use `validates :object, presence: true` instead of `validates :object_id, presence: true`.
This does not apply in the same way to validations on uniqueness of certain attributes, such as `validates :object_id, uniqueness...`
Enumerable#uniq is fine (eg calling #uniq on an Array object), but now using #uniq on an ActiveRecord::Relation is deprecated in favour of #distinct (which modifies the query itself, as opposed to iterating over the results of the query).
DEPRECATION WARNING: ActiveModel::Errors#set is deprecated and will be removed in Rails 5.1. Use model.errors.add(:preferred_discount_amount, ["has an invalid format. Please enter a number."]) instead. (called from block (2 levels) in localize_number at /home/runner/work/openfoodnetwork/openfoodnetwork/lib/spree/localized_number.rb:38)