-
Notifications
You must be signed in to change notification settings - Fork 899
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
Bug with enum / enums #798
Comments
Hi Mohamed, Sounds like you're on the right track! Thanks for the issue report. Can you convert what you've got into a script, using our bug report template? Thanks! |
Here it is bug report. Without |
Thanks Mohamed! I will mark this as a confirmed bug. Your test passes in PT 4.1.0, so this appears to be a regression between 4.1.0 and 5.0.1. |
This still appears to be an issue even in 5.1.1. Both update and destroy events still store the enum columns in the object data as |
That is correct. I played around with a fix in #805 but wasn't happy with my implementation. If you have any suggestions of how to fix it, I'd welcome them. |
Have either of you (Mohamed, barnone27) had any luck fixing this? I don't use enums, so this is a low priority for me, but if either of you can take the lead on this, I'd be happy to help. |
Enums are very common now - I would hope this becomes a higher priority bug to fix if possible. |
I'm actually not sure what the right way to fix this is. See #805 for something you can build on. Contributions are welcome, thanks! |
It's worth pointing out that this is not an issue with rails 5, only with rails 4.2. |
Fixes #798 Our test suite has one model that tests enums, PostWithStatus. Its spec did not cover `touch_with_version`. Somehow, probably during our upgrade to rails 5, we broke `touch_with_version` for enums. Unlike other methods, when an enum arrives at `CastAttributeSerializer#serialize` during `touch_with_version`, it is already a number. We assumed it was always a string. This is sort of a hack, just handling both strings and numbers in `#serialize`. I'd rather figure out how a number got to `#serialize` in the first place. However, a hack is acceptable, as it's only for rails 4.2, and the hack will eventually be deleted when we drop support for 4.2.
Fixes #798 Our test suite has one model that tests enums, PostWithStatus. Its spec did not cover `touch_with_version`. Somehow, probably during our upgrade to rails 5, we broke `touch_with_version` for enums. Unlike other methods, when an enum arrives at `CastAttributeSerializer#serialize` during `touch_with_version`, it is already a number. We assumed it was always a string. This is sort of a hack, just handling both strings and numbers in `#serialize`. I'd rather figure out how a number got to `#serialize` in the first place. However, a hack is acceptable, as it's only for rails 4.2, and the hack will eventually be deleted when we drop support for 4.2.
Fixes #798 Our test suite has one model that tests enums, PostWithStatus. Its spec did not cover `touch_with_version`. Somehow, probably during our upgrade to rails 5, we broke `touch_with_version` for enums. Unlike other methods, when an enum arrives at `CastAttributeSerializer#serialize` during `touch_with_version`, it is already a number. We assumed it was always a string. This is sort of a hack, just handling both strings and numbers in `#serialize`. I'd rather figure out how a number got to `#serialize` in the first place. However, a hack is acceptable, as it's only for rails 4.2, and the hack will eventually be deleted when we drop support for 4.2.
@WaKeMaTTa, @barnone27, and @key88sf please try |
Released in 5.2.1. Please test, thanks! |
It works perfectly. Good job. 🎉 I'm so sorry because when you posted this:
I did try master, but i forgot to give you the feedback (It didn't work). Sorry. |
Thanks Mohamed. That code ( |
Hi,
I have a bug with
enums
andpaper_trail
. I will explain the bug with a dummy example.Some extra info
--with-associations
)The text was updated successfully, but these errors were encountered: