diff --git a/app/controllers/avo/associations_controller.rb b/app/controllers/avo/associations_controller.rb index 7b6a74e6c..467f09e46 100644 --- a/app/controllers/avo/associations_controller.rb +++ b/app/controllers/avo/associations_controller.rb @@ -117,6 +117,13 @@ def destroy def set_reflection @reflection = @record.class.reflect_on_association(association_from_params) + + # Ensure inverse_of is present on STI + if !@record.class.descends_from_active_record? && @reflection.inverse_of.blank? && Rails.env.development? + raise "Avo relies on the 'inverse_of' option to establish the inverse association and perform some specific logic.\n" \ + "Please configure the 'inverse_of' option for the '#{@reflection.macro} :#{@reflection.name}' association " \ + "in the '#{@reflection.active_record.name}' model." + end end def set_attachment_class