Active Storage needs a checksum for each file and AWS S3 provides this
checksum as "ETag". They are both MD5 but AWS stores it as hexdigest and
Active Storage as base64digest. We need to convert it from on to the
other to get a valid checksum for Active Storage.
Where the migration task has already run (only staging servers), delete all
Active Storage data first and then run the task again:
bundle exec rake db:migrate:down VERSION=20220316055458
bundle exec rake db:migrate
bundle exec rake from_paperclip_to_active_storage:copy_content_config
bundle exec rake from_paperclip_to_active_storage:migrate
Common migrations look for all models with *_file_name attributes but I
found that unreliable in our code base. It finds too many model classes
and doesn't allow us to be more selective in the migration. So I used
our own migration declaration to migrate exactly those attachments
specified.
We removed some Spree magic a while back and that broke our sample data
script. This is now corrected.
I also added a spec so that we will notice broken seed data earlier.
For larger queries and especially where filtering and paginating, these simpler product queries are way more efficient. It cuts out some very large subqueries with large lists of product ids.
Rubocop often complains while we think that the code is totally fine. I
would like to achieve the default values one day but there are more
important issues at the moment.
We had an old version under "contested settings" and it looks like some
of them were modified. I hope that our new, separate file will
discourage manual tweaks.
We can include the relaxed rules from a gem as well. Let's see if we
need that complexity one day.
DEPRECATION WARNING: #search is deprecated and will be removed in 2.3, please use #ransack instead (called from search at /home/user/Github/openfoodnetwork/lib/open_food_network/sales_tax_report.rb:40)
Before the :scope_to_distributor call was filtering out variants from other distributors anyway via the :exchange_variants table but it is clearer if we filter by distributor on the :variant_overrides left join too.