Use the Rails config.to_prepare hook to load the theme assets
Use the Rails config.to_prepare hook to load the theme assets

Rails 5 has introduced changes to the load order so now
`Rails.application.config.assets.paths` is populated later - as part of
the initialization process - so when our original code tries to prepend
theme paths from `initializers/theme_loader.rb`, it is adding to an
empty array which results in our custom paths being the last to be
searched after the Rails and core app paths have been loaded.

The `after_initialize` hook is too late as - if caching is in effect -
the Sprockets environment has been cached at this point (and the path
array is frozen), and changing `Rails.application.config.assets` has no
effect. As `Rails.config.to_prepare` runs after the initializers but
while changes can still be made and only runs once (at boot-up) in
production so it should be a good choice:

https://guides.rubyonrails.org/configuring.html#initializers

mysociety/whatdotheyknow-theme,mysociety/whatdotheyknow-theme,mysociety/whatdotheyknow-theme