Open
Description
We have a baseclass ApiSerializer
with the shared behaviour of all subclasses.
In our testsuite we use an anonymous subclass of ApiSerializer
to test some behaviour.
I.e. like this:
serializer_klass = Class.new(ApiSerializer) do
has_one :some_thing
has_many :many_things
attribute :foo { 'bar' }
end
This gives me an error:
#<NoMethodError: undefined method `end_with?' for nil:NilClass>
["fast_jsonapi-1.5/lib/fast_jsonapi/object_serializer.rb:133:in `reflected_record_type'",
"fast_jsonapi-1.5/lib/fast_jsonapi/object_serializer.rb:125:in `inherited'",
"(irb):17:in `initialize'",
"(irb):17:in `new'",
...
]
ObjectSerializer tries to determine the record type based on the class name, but does not take into account that the class can be unnamed:
if self.name.end_with?('Serializer')
Metadata
Metadata
Assignees
Labels
No labels