Set the record type for inherited serializers
This commit is contained in:
parent
5aa5dc511c
commit
77c7af2a5e
@ -119,6 +119,7 @@ module FastJsonapi
|
||||
subclass.race_condition_ttl = race_condition_ttl
|
||||
subclass.data_links = data_links
|
||||
subclass.cached = cached
|
||||
subclass.set_type(subclass.reflected_record_type) if subclass.reflected_record_type
|
||||
end
|
||||
|
||||
def reflected_record_type
|
||||
|
@ -95,6 +95,11 @@ describe FastJsonapi::ObjectSerializer do
|
||||
has_one :account
|
||||
end
|
||||
|
||||
it 'sets the correct record type' do
|
||||
expect(EmployeeSerializer.reflected_record_type).to eq :employee
|
||||
expect(EmployeeSerializer.record_type).to eq :employee
|
||||
end
|
||||
|
||||
context 'when testing inheritance of attributes' do
|
||||
|
||||
it 'includes parent attributes' do
|
||||
|
Loading…
x
Reference in New Issue
Block a user