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

Ability to conditionally set metadata on a version record depending on the event (create, update, etc) #1463

Open
thatandyrose opened this issue Feb 22, 2024 · 1 comment
Labels

Comments

@thatandyrose
Copy link

thatandyrose commented Feb 22, 2024

Is your feature suggestion related to a problem? Please describe.

It is not related to a problem or bug. It's an improvement I believe could be helpful to those using the meta columns feature.

Describe the solution you'd like to build

I would like to be able to conditionally set metadata on a version record depending on the event (create, update, etc).

I believe the best way to do this is to pass an additional parameter to the proc that can be set on the meta attributes. I believe the only change needed would be here:

value.call(@record)

To change:

value.call(@record)

to

value.call(@record, event)

This should be backwards compatible.

Having this change would then enable the user to check the event type, and change what metadata is being stored.

I'd be happy to make this change.. however not sure how to test it 🤔 Probably add a new context in the widget model spec for a model that has an event conditional meta data saving definition in there? 🤷🏽 open to suggestions.

Describe alternatives you've considered

The alternative I'm toying with at the moment is just to always save the metadata.. which for me would be expensive since it's a large json object.. I don't want to do it in every event. OR, I'm thinking of doing an inspect on caller and checking to see what build_version_on_* method is being called. It's not great or 100% but should be enough for my needs.. so feels yuk and brittle :-)

Copy link

This issue has been automatically marked as stale due to inactivity.
The resources of our volunteers are limited.
Bug reports must provide a script that reproduces the bug, using our template. Feature suggestions must include a promise to build the feature yourself.
Thank you for all your contributions.

@github-actions github-actions bot added the Stale label May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant