mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Make #event! methods return a boolean [Joel Chippindale]
This commit is contained in:
parent
073bcbf695
commit
a68200556e
2 changed files with 7 additions and 2 deletions
|
@ -0,0 +1 @@
|
|||
* Make #event! methods return a boolean [Joel Chippindale]
|
|
@ -31,8 +31,12 @@ module AASM
|
|||
|
||||
define_method("#{name.to_s}!") do
|
||||
new_state = self.class.aasm_events[name].fire(self)
|
||||
self.aasm_current_state = new_state unless new_state.nil?
|
||||
nil
|
||||
unless new_state.nil?
|
||||
self.aasm_current_state = new_state
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue