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

Add support to custom version association class #46

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sobrinho
Copy link

Fixes #45

@sobrinho
Copy link
Author

This is a draft, still needs to be tested.

@sobrinho
Copy link
Author

sobrinho commented Jul 2, 2024

@westonganger ping :)

@westonganger
Copy link
Owner

@sobrinho I don't see any documentation for this. Can you write some in the readme. Then it should be easier to review.

@sobrinho
Copy link
Author

sobrinho commented Jul 2, 2024

@westonganger added a small example to README.md.

Is that what you are looking for?

This is the same as papertrail has for the version class, we have a use case like this :

class Product < ApplicationRecord
  has_paper_trail(
    versions: { class_name: "ProductVersion" }, # papertrail has this native
    version_associations: { class_name: "ProductVersionAssociation" } # this PR will add this one
  )
end

@westonganger
Copy link
Owner

Ok looks alright. Can you also add a changelog entry for this

@sobrinho
Copy link
Author

sobrinho commented Jul 4, 2024

@westonganger added

@westonganger
Copy link
Owner

Sorry to keep asking for more. But can you actually write one or two tests for this feature?

@westonganger
Copy link
Owner

@sobrinho ping

@sobrinho
Copy link
Author

@westonganger will do today or tomorrow

@sobrinho
Copy link
Author

sobrinho commented Aug 7, 2024

@westonganger can you review this again?

I had to change the implementation a little bit and I'm not 100% sure this is in the right direction.

@sobrinho
Copy link
Author

sobrinho commented Aug 7, 2024

Even if I remove the PaperTrailAssociationTracking::VersionConcern entirely, specs still passes.

So, looks like after this we are decoupling Version and VersionAssociation entirely.

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

Successfully merging this pull request may close these issues.

Allow to customize/extend PaperTrail::VersionAssociation
3 participants