mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Include basic information about Mongoid usage
This commit is contained in:
parent
d9c0ebad95
commit
2d475dc6ba
1 changed files with 16 additions and 0 deletions
16
README.md
16
README.md
|
@ -239,6 +239,21 @@ class Job < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Mongoid
|
||||||
|
|
||||||
|
AASM also supports persistence to Mongodb if you're using Mongoid. Make sure
|
||||||
|
to include Mongoid::Document before you include AASM.
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
class Job
|
||||||
|
include Mongoid::Document
|
||||||
|
include AASM
|
||||||
|
aasm do
|
||||||
|
...
|
||||||
|
end
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
### Automatic Scopes
|
### Automatic Scopes
|
||||||
|
|
||||||
AASM will automatically create scope methods for each state in the model.
|
AASM will automatically create scope methods for each state in the model.
|
||||||
|
@ -290,6 +305,7 @@ end
|
||||||
|
|
||||||
Since version *3.0.13* AASM supports ActiveRecord transactions. So whenever a transition
|
Since version *3.0.13* AASM supports ActiveRecord transactions. So whenever a transition
|
||||||
callback or the state update fails, all changes to any database record are rolled back.
|
callback or the state update fails, all changes to any database record are rolled back.
|
||||||
|
Mongodb does not support transactions.
|
||||||
|
|
||||||
### Column name & migration
|
### Column name & migration
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue