From 32c1c962db194fe16df4d83a9635f9c47e6f0a74 Mon Sep 17 00:00:00 2001 From: Adrien Siami Date: Wed, 7 Aug 2013 17:35:31 +0200 Subject: [PATCH] Allow overwriting of events, can be very useful with inheritance --- lib/aasm/base.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/aasm/base.rb b/lib/aasm/base.rb index d992a62..d0f01d4 100644 --- a/lib/aasm/base.rb +++ b/lib/aasm/base.rb @@ -48,9 +48,7 @@ module AASM def event(name, options={}, &block) # @clazz.aasm_event(name, options, &block) - unless @state_machine.events.has_key?(name) - @state_machine.events[name] = AASM::Event.new(name, options, &block) - end + @state_machine.events[name] = AASM::Event.new(name, options, &block) # an addition over standard aasm so that, before firing an event, you can ask # may_event? and get back a boolean that tells you whether the guard method