allow reloading of models
This commit is contained in:
@@ -83,6 +83,11 @@ module HasAuxTable
|
||||
aux_class_name = aux_table_name.to_s.camelize
|
||||
aux_association_name = aux_table_name.to_s.singularize.to_sym
|
||||
|
||||
# Ensure the class name doesn't conflict with existing constants
|
||||
if Object.const_defined?(aux_class_name)
|
||||
Object.send(:remove_const, aux_class_name)
|
||||
end
|
||||
|
||||
# Get the current class for the association
|
||||
main_class = T.cast(self, T.class_of(ActiveRecord::Base))
|
||||
main_association_name = foreign_key.to_s.delete_suffix("_id").to_sym
|
||||
|
||||
Reference in New Issue
Block a user