mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Added documentation for auto-generated constants
This is a great feature that I’ve researched in the past and found no information before. A colleague finally found a merged PR related to this and it’s a shame it isn’t documented.
This commit is contained in:
parent
9866206609
commit
65ddcfaf38
1 changed files with 22 additions and 0 deletions
22
README.md
22
README.md
|
@ -418,6 +418,28 @@ SimpleMultipleExample.aasm(:work).states
|
|||
*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.
|
||||
|
||||
### 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
|
||||
|
||||
AASM allows you to easily extend `AASM::Base` for your own application purposes.
|
||||
|
|
Loading…
Reference in a new issue