mirror of
https://github.com/aasm/aasm
synced 2023-03-27 23:22:41 -04:00
Document return value for auto-saved state transitions
My team just ran into a bug that took a long time to track down where an auto-saved state transition method unexpectedly swallowed exceptions. Some documentation on the behavior would have saved a lot of searching. :)
This commit is contained in:
parent
467e173849
commit
f270936f99
1 changed files with 7 additions and 5 deletions
12
README.md
12
README.md
|
@ -423,11 +423,13 @@ job.run # not saved
|
||||||
job.run! # saved
|
job.run! # saved
|
||||||
```
|
```
|
||||||
|
|
||||||
Saving includes running all validations on the `Job` class. If you want make sure
|
Saving includes running all validations on the `Job` class, and returns `true` if
|
||||||
the state gets saved without running validations (and thereby maybe persisting an
|
successful or `false` if errors occur. Exceptions are not raised.
|
||||||
invalid object state), simply tell AASM to skip the validations. Be aware that
|
|
||||||
when skipping validations, only the state column will be updated in the database
|
If you want make sure the state gets saved without running validations (and
|
||||||
(just like ActiveRecord `change_column` is working).
|
thereby maybe persisting aninvalid object state), simply tell AASM to skip the
|
||||||
|
validations. Be aware that when skipping validations, only the state column will
|
||||||
|
be updated in the database (just like ActiveRecord `change_column` is working).
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
class Job < ActiveRecord::Base
|
class Job < ActiveRecord::Base
|
||||||
|
|
Loading…
Reference in a new issue