1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

fixed auth_machine, used different syntaxes to do same thing

This commit is contained in:
Vladimir Meremyanin 2013-03-06 21:06:49 +04:00
parent 6f75f5c63c
commit 2ac052e8fa

View file

@ -12,7 +12,11 @@ class AuthMachine
state :waiting
event :register do
transitions :from => :passive, :to => :pending, :guard => Proc.new {|u| u.can_register? }
transitions :from => :passive, :to => :pending do
guard do
can_register?
end
end
end
event :activate do
@ -33,8 +37,8 @@ class AuthMachine
end
event :unsuspend do
transitions :from => :suspended, :to => :active, :guard => Proc.new {|u| u.has_activated? }
transitions :from => :suspended, :to => :pending, :guard => Proc.new {|u| u.has_activation_code? }
transitions :from => :suspended, :to => :active, :guard => Proc.new { has_activated? }
transitions :from => :suspended, :to => :pending, :guard => :has_activation_code?
transitions :from => :suspended, :to => :passive
end