This blog is part of our Rails 7 series.
If Active Storage has been configured, and the service type has not been explicitly set in the respective environment's configuration file, then trying to use active storage throws the following error message:
1Failed to replace attachments_attachments because one or more of the new records could not be saved.
This is not helpful, and it doesn't indicate where to make the required changes for Active Storage to be able to save the attachment(s). It also allows the application to start as if a valid service has been set for Active Storage to use. Starting Rails 7.1, if config.active_storage.service has not been explicitly set, then even attempting to start the application would throw a RuntimeError with the following error message:
1Missing Active Storage service name. Specify Active Storage service name for config.active_storage.service in config/environments/production.rb
Please check out this pull request for more details.