-
Notifications
You must be signed in to change notification settings - Fork 0
Fix compose objs #13
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
Fix compose objs #13
Conversation
|
So this is the only way I found to make things work. I put back Enumerable, otherwise it enforces us to us an array as input but we lose ActiveRecord relations (not sure of me, but couldn't serialize nested objects). I've added a new case for Hashes to use @tgallice @AlexisMontagne What do you think about that ? |
| if obj.is_a? Array | ||
| ArraySerializer.new(obj, opts) | ||
| else | ||
| if obj.is_a?(Hash) || !obj.is_a?(Enumerable) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think should wrap most of the cases, but if we have a Nil class passed here, it will jump inside of this if.
Should we consider this scenario?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is the same behaviour as before. There was an else that would catch everything else including Nil class.
tgallice
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:/
What does this PR do?
What are the observable changes?
Good PR checklist
Additional Notes