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:
parent
6f75f5c63c
commit
2ac052e8fa
1 changed files with 7 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue