This repo is an example application that demonstrates the ability to track specific changes for AASM with Papertrail.
It is a possible solution response to: aasm/aasm#490
- Track model AASM state transitions and all changed data
- Be able to query for specific transitions
- The version is isolated against all the noise of the rest of versions thus allows it to become a first class citizen/tracking object.
- Get papertrail version/change querying.
- For us, the transitioning event name was enough to query/isolate against specific transitions, but it is possible to query directly against object changes.
- We also wanted to only track transitions and realized if there were other versions being created other than event transitions, we would immediately know we had leaky mutations.
- In this case, over-tracking is helpful.
- When between-transition mutations are valid, just put a scope on the version model that filters the CRUD events.
git clone
cd
bundle install
bundle exec rails db:setup
bundle exec rails db:seed
bundle exec rails s
- Visit
http://localhost:3000/posts
- Login with
- Username:
[email protected]
- Password:
admin
- Username:
- All posts' changes are tracked via a separate model which is a first class citizen in table
post_versions
. - All changes to comments and users are tracked via normal versions table.