16470: Avoids crashing when running db:create in development mode.
authorLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 17 Aug 2020 17:38:06 +0000 (14:38 -0300)
committerLucas Di Pentima <lucas@di-pentima.com.ar>
Mon, 17 Aug 2020 17:38:06 +0000 (14:38 -0300)
The 'preload_all_models' initializer is now run even when db:create is
called, so it avoids the database to be created on arvbox, for example,
because it attempts to access the database before being created.

This initializer was added 7 years ago and it now seems to not be needed
anymore, so I think it's the cleaner way to resolve this issue.

See: https://github.com/rails/rails/issues/32870

Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas@di-pentima.com.ar>

services/api/config/initializers/preload_all_models.rb [deleted file]

diff --git a/services/api/config/initializers/preload_all_models.rb b/services/api/config/initializers/preload_all_models.rb
deleted file mode 100644 (file)
index 713c61f..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright (C) The Arvados Authors. All rights reserved.
-#
-# SPDX-License-Identifier: AGPL-3.0
-
-# See http://aaronvb.com/articles/37-rails-caching-and-undefined-class-module
-
-# Config must be done before we load model class files; otherwise they
-# won't be able to use Rails.configuration.* to initialize their
-# classes.
-
-if Rails.env == 'development'
-  Dir.foreach("#{Rails.root}/app/models") do |model_file|
-    require_dependency model_file if model_file.match(/\.rb$/)
-  end
-end