From 24a4778ad4225c755746d63420ec649fbe661e6b Mon Sep 17 00:00:00 2001 From: Vladimir Meremyanin Date: Thu, 21 Feb 2013 12:05:38 +0400 Subject: [PATCH] fixed errors catching/raising --- lib/aasm/aasm.rb | 2 +- lib/aasm/supporting_classes/event.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/aasm/aasm.rb b/lib/aasm/aasm.rb index 330eee6..a307129 100644 --- a/lib/aasm/aasm.rb +++ b/lib/aasm/aasm.rb @@ -213,7 +213,7 @@ private end end rescue StandardError => e - event.fire_callbacks(:error, self, e) + event.fire_callbacks(:error, self, e) || raise(e) end end end diff --git a/lib/aasm/supporting_classes/event.rb b/lib/aasm/supporting_classes/event.rb index 3982d5b..c1d6f76 100644 --- a/lib/aasm/supporting_classes/event.rb +++ b/lib/aasm/supporting_classes/event.rb @@ -92,10 +92,15 @@ module AASM case code when Symbol, String record.send(code, *args) + true when Proc record.instance_exec(*args, &code) + true when Array code.each {|a| invoke_callbacks(a, record, args)} + true + else + false end end