Clarify STI models loading process with a comment.

This commit is contained in:
Pavel Balashou
2025-07-07 11:01:32 +02:00
parent 98019caf7b
commit 041ca224c3
+8 -3
View File
@@ -28,16 +28,21 @@
# See COPYRIGHT and LICENSE files for more details.
#++
# Here we are loading STI models explicitly using rails autoloader.
# It is relevant for environments where lazy loading is enabled (usually, development and testing).
# If an STI model has not been loaded it can lead to undesired behavior like:
# Fetching not loaded yet STI model (ServiceAccount) through its parent model(User)
# (e.g. User.find(service_account_id) raises ActiveRecord::NotFound.
Rails.application.config.to_prepare do
# Load Enumeration descendants due to STI
# Load Enumeration descendants
IssuePriority
# Load Principal descendants due to STI
# Load Principal descendants
User
PlaceholderUser
Group
# Use User descendants due to STI
# Load User descendants
SystemUser
AnonymousUser
Users::InexistentUser