Warn if paper_trail_on_destroy(:after) is combined with ActiveRecord belongs_to_required_by_default#808
Warn if paper_trail_on_destroy(:after) is combined with ActiveRecord belongs_to_required_by_default#808jaredbeck merged 1 commit intopaper-trail-gem:4.1-stablefrom md5:backport-683
Conversation
| send "#{recording_order}_destroy", | ||
| :record_destroy, | ||
| :if => :save_version? | ||
| if recording_order.to_s == 'after' and |
There was a problem hiding this comment.
Note, I changed this from recording_order == 'after' to recording_order.to_s == 'after' to ensure that the warning is still issued when the :after symbol is used. This fix should probably be made on master as well.
There was a problem hiding this comment.
Good idea!
This fix should probably be made on master as well.
Please do, thanks!
There was a problem hiding this comment.
I opened #813
I added a spec to test that the warning is actually being issued and it's not passing for some reason. We can discuss on the PR.
|
Incidentally, I'm not sure I agree with the fix in #683. I probably would have set |
|
Hmm, it looks like CI didn't run, maybe because this PR isn't against the master branch? |
|
@jaredbeck I'm not sure. The only setting I'm familiar with in Travis that affects whether a branch builds is the "Build only if .travis.yml is present" setting. |
|
I can't find anything in their docs, so I reached out to Travis support. If you want to get CC'd on it, send me your email. Mine's jared@jaredbeck.com. |
|
@jaredbeck If you don't mind I can wait for a report back. |
|
Re: changing to optional relationship, see discussion in #682. |
|
Cherry picked commits get a new SHA, so Travis should build it based on the
PR.
As for changing the relationship to required, I don't see much discussion
in #682, other than @jaredbeck saying he'd like it to be required (which is
not the case in Rails 4, as I'm sure you both know)
|
|
I got a response back from Travis CI:
Please try pushing a new commit, Mike. |
|
@jaredbeck I did a no-op |
| @@ -29,7 +29,7 @@ | |||
| it 'should default to after destroy' do | |||
There was a problem hiding this comment.
Not sure how I missed that while pulling in the cherry-picked commit... Fixed in 65c3ce4
|
Do you understand this |
|
@jaredbeck I'm not sure what the deal is with that Bundler failure though. |
|
Mike, please rebase. The dependency resolution issue should be fixed by 29786c3 |
|
@jaredbeck Rebased |
|
Mike, I just realized this is a breaking change. We're trying to follow semver, so we can't have a breaking change in 4.2. Would you mind if we just add the warning message, and do not change the default order? Sorry for realizing this so late, I guess I was focused on getting the travis build to pass. |
|
@jaredbeck Updated to just be a warning |
|
Thanks Mike! Sorry for all the grief with the Travis build. |
|
No worries |
Based on 18d35ef (see #683, #682)
cc/ @owenr