-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Having attribute :name
in a serializer causes exceptions
#1094
Having attribute :name
in a serializer causes exceptions
#1094
Conversation
Could you state the version and adapter that lead to the error? |
@beauby should be clear from the tests when (if) they fail. The error reproduces on master, the serializer is super simple:
|
Sure, but which adapter? (json, flatten_json, json_api?) |
@beauby oh, sorry :) json |
Looking at the test failures seems like it's universal for all adapters |
Investigating! |
Found the cause, but no fix yet. |
Hmm actually it's no surprise overriding |
So this returns whether the class method exists or not. In this case, we are interested in instance methods, so |
Thanks a lot for the clarification @kayhide! |
Having
attribute :name
in a serializer breaks withNoMethodError: undefined method 'name' for #<AuthorSerializer:0x007ffe5afe6810>
.But
attributes :id, :name
works..I've changed one of the test serializers to demonstrate the issue.
I'll try to find time later to investigate some more, unless there is not an obvious fix someone could point me to.