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

feat(model): Introduce poro model plugin #9

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

okuramasafumi
Copy link
Contributor

I found that in a Rails app, we see the following error with serializers for POROs.

NoMethodError: undefined method `columns_hash' for class GoalSettingCourse (NoMethodError)

        @columns_hash = model_class&.columns_hash || {}
                                   ^^^^^^^^^^^^^^

This should be fixed by using Poro model plugin for those serializers.

This model plugin would be used in serializers for PORO.
It's implementation is empty but it works as expected.
See spec/app/app/serializers/alba/poro_serializer.rb for details.
@skryukov
Copy link
Owner

Hey, @okuramasafumi thanks for the PR!

I have a question: why do you set typelize_from for a PORO? i.e. commenting out both typelize_from and typelizer_config from the PoroSerializer will end up with the same result 👀

@okuramasafumi
Copy link
Contributor Author

okuramasafumi commented Sep 30, 2024

@skryukov In our Rails app, without typelize_from it automatically sets model and causes the error. However, in the test app, it's under Alba module so typelize_from was required to reproduce the issue. Or maybe I'm wrong, but I couldn't reproduce it without it.

@skryukov skryukov merged commit e2d065b into skryukov:main Sep 30, 2024
5 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