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

fix: handle non-primary-key, non-assoc fields #39

Merged
merged 1 commit into from
Oct 10, 2024
Merged

fix: handle non-primary-key, non-assoc fields #39

merged 1 commit into from
Oct 10, 2024

Conversation

lurodrigo
Copy link
Contributor

@lurodrigo lurodrigo commented Oct 9, 2024

Following up on #37, I believe this solves the problem for regular fields which are not keys. The proposed solution is to always store a :prefix in the result of validate_opts!, even when it's nil. So for assocs prefix is going to be nil, and for regular fields it's going to store the actual vakue.

Inside find_prefix, we use the stored :prefix if it's not nil (in case of primary keys and non-key fields), otherwise, (assocs) we fetch the prefix in the associated module's schema.

I'm just not sure it doesn't break any existing use.

@sloanelybutsurely
Copy link
Owner

i don't think there's much risk here. thanks for the PR!

@sloanelybutsurely sloanelybutsurely merged commit 1c0bd89 into sloanelybutsurely:main Oct 10, 2024
2 checks passed
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.

2 participants