Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

README Update: More clearly outline built-in validation behavior and persistence patterns #4

Open
smudge opened this issue Jan 11, 2019 · 0 comments

Comments

@smudge
Copy link
Member

smudge commented Jan 11, 2019

  1. Built-in validations include:
  • An "inclusion" error when you are assigning to a state that doesn't exist.
  • An "invalid" error when you are assigning to a state that is not allowed.
  1. When persisting, it's important that with_lock be used to guard against double-submit race conditions. This is especially important if there are any side-effects to taking the action. (Less important if the action is basically idempotent.)
  • As part of this, all validation errors, attribute assignment, and callbacks should happen inside of the with_lock block -- it is not enough to put only the call to save inside of the lock if there are other things happening around the persistence.
  1. It should be possible to customize the built-in validation messages via en.yml (since they use the built-in :inclusion and :invalid keys).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant