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

Allow use of null values in enums on active record 5 #833

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jtagle2
Copy link

@jtagle2 jtagle2 commented Oct 10, 2023

Currently, if you have enum with null values, it fails the validation on CanCanCan because it casts the values received on the condition to strings, but the values that comes from the subject are not casted. This PR tries to manage that case, because nil in ruby is casted to the empty string, so if you have a condition like can action, model, enum_attribute: [null, :value], on the accessible_by it works correctly for rows with null value, but when doing the can? on a specific record, it fails if it has null value.

@jtagle2 jtagle2 force-pushed the develop branch 3 times, most recently from a3f9f3e to ff43b72 Compare October 10, 2023 22:25
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.

1 participant