From 48b646ca4ad2c453c847bf4bedb6637e0de16205 Mon Sep 17 00:00:00 2001 From: Alex Willemsma Date: Sun, 6 Jul 2014 21:16:02 -0700 Subject: [PATCH] Passing the associate when raising an exception on save! failure. Rails 4 apparently expects this exction to take a single parameter now (the record that caused the exception). Passing the associate satisfies the dependancy and still lets the exception be thrown, rather than immediately dying due to bad parameters. --- lib/associates/persistence.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/associates/persistence.rb b/lib/associates/persistence.rb index 52e0aec..380b5f3 100644 --- a/lib/associates/persistence.rb +++ b/lib/associates/persistence.rb @@ -36,7 +36,7 @@ def persisted? # @return [True, ActiveRecord::RecordInvalid] def save! - save || raise(ActiveRecord::RecordInvalid) + save || raise(ActiveRecord::RecordInvalid.new(self)) end end end