models_preload.rb 446 B

1234567891011121314
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. # Ensure all models are preloaded, as Zammad uses reflections
  3. # which rely on all model classes being present.
  4. Rails.application.reloader.to_prepare do
  5. begin
  6. Models.all
  7. rescue ActiveRecord::StatementInvalid
  8. nil
  9. rescue ActiveRecord::ConnectionNotEstablished, ActiveRecord::NoDatabaseError => e
  10. warn e
  11. Zammad::SafeMode.continue_or_exit!
  12. end
  13. end