Skip to content

Commit a4974a3

Browse files
authored
fix: display a warning on missing association (#426)
1 parent 8fa4944 commit a4974a3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/services/forest_liana/schema_utils.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,14 @@ module ForestLiana
22
class SchemaUtils
33

44
def self.associations(active_record_class)
5-
active_record_class
6-
.reflect_on_all_associations
7-
.select { |association| !polymorphic?(association) && !is_active_type?(association.klass) }
5+
active_record_class.reflect_on_all_associations.select do |association|
6+
begin
7+
!polymorphic?(association) && !is_active_type?(association.klass)
8+
rescue
9+
FOREST_LOGGER.warn "Unknown association #{association.name} on class #{active_record_class.name}"
10+
false
11+
end
12+
end
813
end
914

1015
def self.one_associations(active_record_class)

0 commit comments

Comments
 (0)