panko_serializer: panko <3 breaks with Rails 8.0.0.beta1
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:
class LoopSerializer < Panko::Serializer
attributes :id
end
I’m calling it from the rails console with LoopSerializer.new.serialize(Loop.first)
and getting the following stacktrace:
panko_serializer (0.8.2) lib/panko/serializer.rb:141:in `serialize_object': undefined method `default' for an instance of ActiveRecord::Result::IndexedRow (NoMethodError)
Panko.serialize_object(object, writer, @descriptor)
^^^^^^^^^^^^^^^^^
from panko_serializer (0.8.2) lib/panko/serializer.rb:141:in `serialize_with_writer'
from panko_serializer (0.8.2) lib/panko/serializer.rb:130:in `serialize'
from (sked):3:in `<main>'
from <internal:kernel>:187:in `loop'
from rails (865a3a2ef5cf) railties/lib/rails/commands/console/irb_console.rb:129:in `start'
from rails (865a3a2ef5cf) railties/lib/rails/commands/console/console_command.rb:59:in `start'
from rails (865a3a2ef5cf) railties/lib/rails/commands/console/console_command.rb:8:in `start'
from rails (865a3a2ef5cf) railties/lib/rails/commands/console/console_command.rb:87:in `perform'
from thor (1.3.2) lib/thor/command.rb:28:in `run'
from thor (1.3.2) lib/thor/invocation.rb:127:in `invoke_command'
from rails (865a3a2ef5cf) railties/lib/rails/command/base.rb:178:in `invoke_command'
from thor (1.3.2) lib/thor.rb:538:in `dispatch'
from rails (865a3a2ef5cf) railties/lib/rails/command/base.rb:73:in `perform'
from rails (865a3a2ef5cf) railties/lib/rails/command.rb:65:in `block in invoke'
from rails (865a3a2ef5cf) railties/lib/rails/command.rb:143:in `with_argv'
from rails (865a3a2ef5cf) railties/lib/rails/command.rb:63:in `invoke'
... 5 levels...
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 ?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (11 by maintainers)
@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:
Can you please release a new version of the gem that contains the aforementioned fix?
Released a version: https://github.com/yosiat/panko_serializer/releases/tag/v0.8.3 with Rails 8.0 support.
Thanks for everyone for reporting about the issue and testing the master branch 🙏
I’ll close this issue… if you observe any issues with this release, please open new issue.