diff --git a/CHANGELOG.md b/CHANGELOG.md index ef9acc2..4bc9941 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.2.1 + +### Changed + +- Ignore invalid associations when inspecting reflections on `sync_all!` to establish the load order. These kinds of errors have nothing to do with the support table definition and create confusion when the are raised while syncing data. + ## 1.2.0 ### Added diff --git a/VERSION b/VERSION index 26aaba0..6085e94 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.0 +1.2.1 diff --git a/lib/support_table_data.rb b/lib/support_table_data.rb index d008335..7c52f05 100644 --- a/lib/support_table_data.rb +++ b/lib/support_table_data.rb @@ -406,6 +406,9 @@ def support_table_dependencies(klass) next unless reflection.belongs_to? || reflection.through_reflection? dependencies << reflection.klass + rescue => e + message = "Error inspecting reflection #{reflection.name} on #{klass.name}: #{e.inspect}" + klass.logger&.warn(message) end dependencies diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 4da7859..382258e 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -57,6 +57,9 @@ class Color < ActiveRecord::Base has_many :things has_many :shades, through: :things + # Intentionally invalid association + belongs_to :non_existent, class_name: "NonExistent" + validates_uniqueness_of :name def group_name=(value)