mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Allow namespacing methods and state constants
This commit is contained in:
parent
5b885c8a0d
commit
86126c7c90
4 changed files with 115 additions and 5 deletions
28
spec/models/namespaced_multiple_example.rb
Normal file
28
spec/models/namespaced_multiple_example.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
class NamespacedMultipleExample
|
||||
include AASM
|
||||
aasm(:status) do
|
||||
state :unapproved, :initial => true
|
||||
state :approved
|
||||
|
||||
event :approve do
|
||||
transitions :from => :unapproved, :to => :approved
|
||||
end
|
||||
|
||||
event :unapprove do
|
||||
transitions :from => :approved, :to => :unapproved
|
||||
end
|
||||
end
|
||||
|
||||
aasm(:review_status, namespace: :review) do
|
||||
state :unapproved, :initial => true
|
||||
state :approved
|
||||
|
||||
event :approve_review do
|
||||
transitions :from => :unapproved, :to => :approved
|
||||
end
|
||||
|
||||
event :unapprove_review do
|
||||
transitions :from => :approved, :to => :unapproved
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue