-
Notifications
You must be signed in to change notification settings - Fork 36
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
panko <3 breaks with Rails 8.0.0.beta1 #166
Comments
Using |
It seems the type of the They're trying to mimick the API of a Hash but it's not one, so that's probably the cause of it |
Calling the private method |
Finally, it comes down here: https://github.com/yosiat/panko_serializer/blob/master/ext/panko_serializer/attributes_writer/active_record.c#L108 and tries to use the lowlevel hash primitive to access the data, but it's not a real hash anymore, so it fails, and it tries to get the default value calling From there I see two options:
In all the case, panko will incur a performance penalty from this new design in AR. TBH, this was my first time digging into the Ruby C API, I don't think I'm the right person to implement at fix :-/ |
In the meantime, a subpar workaround is to override the method def serialize_with_writer(object, writer)
object.attributes # Materializes the LazyAttributeSet
super
end |
Hi @elthariel Thank you for this investigation! |
I'm also facing the same issue in my upgrade to try out rails 8, but unfortunately the solution pointed out by @elthariel is not working for me. What I noticed by opening the I don't have enough knowledge of the inner workings of AR to understand if that means the issue should be fixed at rails itself, just thought I'd point it out here in case it helps. |
@pjpires hey, i am working on rails 8 support it will take sometime.
This issue should be fixed in Panko, since Panko is peeking into Rails internals.. |
@pjpires @elthariel I merged a fix, please test it (via installing from GitHub, from gem 'panko_serializer', github: 'yosiat/panko_serializer', branch: 'master' |
Hey @yosiat. I ran our test suite with your master branch both against rails 8.0.0.beta1 and rc1 which is out already, and everything looks good! Thanks for such a fast response. 🚀 |
@yosiat I was facing the same issue while upgrading one of my Rails app to Rails 8.0.0 stable and I solved it with: gem 'panko_serializer', github: 'yosiat/panko_serializer', branch: 'master' Can you please release a new version of the gem that contains the aforementioned fix? |
Hello,
I'm starting a pet project using the latest rails version 8.0.0.beta1, and it seems the latest ActiveRecord breaks Panko:
Here's a simple Serializer:
I'm calling it from the rails console with
LoopSerializer.new.serialize(Loop.first)
and getting the following stacktrace:
The actual problem is likely in the native extension, but the call to
default
is likely a side effect and I can't trace it.Do you have any thougts ?
The text was updated successfully, but these errors were encountered: