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:
commit
177bc275a1
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
|
*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.
|
||||||
|
|
Loading…
Reference in a new issue