1
0
Fork 0
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:
Dakotah Peña 2016-07-19 16:32:34 -07:00
parent 9866206609
commit 65ddcfaf38

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.