Skip to content

Commit

Permalink
Document return value for auto-saved state transitions
Browse files Browse the repository at this point in the history
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. :)
  • Loading branch information
vergenzt committed Jan 7, 2016
1 parent 467e173 commit f270936
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions README.md
Expand Up @@ -423,11 +423,13 @@ job.run # not saved
job.run! # saved
```

Saving includes running all validations on the `Job` class. If you want make sure
the state gets saved without running validations (and thereby maybe persisting an
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
(just like ActiveRecord `change_column` is working).
Saving includes running all validations on the `Job` class, and returns `true` if
successful or `false` if errors occur. Exceptions are not raised.

If you want make sure the state gets saved without running validations (and
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
class Job < ActiveRecord::Base
Expand Down

0 comments on commit f270936

Please sign in to comment.