1
0
Fork 0
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:
Tim Vergenz 2016-01-07 12:44:10 -08:00 committed by Tim Vergenz
parent 467e173849
commit f270936f99

View file

@ -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