-
Notifications
You must be signed in to change notification settings - Fork 899
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
Add version_error_behavior config option #1450
Conversation
a92fe2f
to
a62ff8c
Compare
This PR has been automatically marked as stale due to inactivity. |
is there any chance of getting this looked at? silently not saving version data is a pretty serious issue imho. |
This PR has been automatically marked as stale due to inactivity. |
still not stale, still waiting for maintainers to chime in. or alternately i'm happy to help out if someone wants to add permissions. |
Thanks for your contribution.
How about extracting private method(s)? |
hi @jaredbeck
this would be a breaking change because of how the existing code works since currently an error is raised when creating but not updating. if that's ok then i'm happy to make the change. |
done. |
This PR has been automatically marked as stale due to inactivity. |
not stale, waiting for reviewers |
+1 I'm pretty sure I've run into this issue with it silently failing and not raising an error. In the past, I only caught it because I happened to watch some It would be rather nice to have this option merged. I would tend to agree with @modosc that this bug when left unfixed causes data integrity / traceability issues and that feels fairly significant. #my2cents |
How about |
4936cb1
to
e7c0685
Compare
@jaredbeck i've made this change, please take a look. thanks! |
dbdae11
to
f1ecd9e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. I appreciate the thorough tests.
nice - should there be documentation for how to use this in the readme? |
i will try to add some in the next few days |
NOTE: all the specs pass locally but rubocop is failing on a complexity check - i'm unsure exactly how to simplify this code to satisfy rubocop without making the intent less clear. happy to hear suggestions? for now i've disabled the check around the offending method
Currently when creating a new versioned record an error is raised if the
Version
cannot be created - this is because#save!
is used:paper_trail/lib/paper_trail/record_trail.rb
Line 62 in 47dbc22
However, when updating, using
update_columns
, or destroying a versioned record no error is raised if theVersion
cannot be created:paper_trail/lib/paper_trail/record_trail.rb
Line 111 in 47dbc22
paper_trail/lib/paper_trail/record_trail.rb
Line 301 in 47dbc22
paper_trail/lib/paper_trail/record_trail.rb
Line 84 in 47dbc22
This pr adds a
always_raise_on_error
global config option. When set, all of the above failures will raise an error.Fixes #1449
Thank you for your contribution!
Check the following boxes:
master
(if not - rebase it).code introduces user-observable changes.
and description in grammatically correct, complete sentences.