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

Merge pull request #386 from Silversheet/document-automatic-constants

Added documentation for auto-generated constants
This commit is contained in:
Anil Kumar Maurya 2016-08-23 12:28:18 +05:30 committed by GitHub
commit 177bc275a1

View file

@ -418,6 +418,28 @@ SimpleMultipleExample.aasm(:work).states
*Final note*: Support for multiple state machines per class is a pretty new feature *Final note*: Support for multiple state machines per class is a pretty new feature
(since version `4.3`), so please bear with us in case it doesn't work as expected. (since version `4.3`), so please bear with us in case it doesn't work as expected.
### Auto-generated Status Constants
AASM automatically [generates constants](https://github.com/aasm/aasm/pull/60)
for each status so you don't have to explicitly define them.
```ruby
class Foo
include AASM
aasm do
state :initialized
state :calculated
state :finalized
end
end
> Foo::STATE_INITIALIZED
#=> :initialized
> Foo::STATE_CALCULATED
#=> :calculated
```
### Extending AASM ### Extending AASM
AASM allows you to easily extend `AASM::Base` for your own application purposes. AASM allows you to easily extend `AASM::Base` for your own application purposes.