From fd3f41584e97d99a4a85fff0bef1d480bb4661a3 Mon Sep 17 00:00:00 2001 From: Jared Beck Date: Sun, 10 Dec 2017 21:44:33 -0500 Subject: [PATCH] Raise when belongs_to_required_by_default Using paper_trail.on_destroy(:after) with ActiveRecord's belongs_to_required_by_default will produce an error instead of a warning. --- lib/paper_trail/model_config.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/paper_trail/model_config.rb b/lib/paper_trail/model_config.rb index da3b63bf..cbe22bc8 100644 --- a/lib/paper_trail/model_config.rb +++ b/lib/paper_trail/model_config.rb @@ -6,7 +6,7 @@ module PaperTrail class ModelConfig E_CANNOT_RECORD_AFTER_DESTROY = <<-STR.strip_heredoc.freeze paper_trail.on_destroy(:after) is incompatible with ActiveRecord's - belongs_to_required_by_default and has no effect. Please use :before + belongs_to_required_by_default. Use on_destroy(:before) or disable belongs_to_required_by_default. STR @@ -45,7 +45,7 @@ module PaperTrail end if recording_order.to_s == "after" && cannot_record_after_destroy? - ::ActiveSupport::Deprecation.warn(E_CANNOT_RECORD_AFTER_DESTROY) + raise E_CANNOT_RECORD_AFTER_DESTROY end @model_class.send(