mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 14:56:50 +00:00
Save result of calling associated_object in a local var
This commit is contained in:
parent
baa690a01a
commit
c1e710aae1
@ -177,8 +177,10 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def serialize_ids
|
def serialize_ids
|
||||||
if associated_object
|
object = associated_object
|
||||||
id = associated_object.read_attribute_for_serialization(embed_key)
|
|
||||||
|
if object
|
||||||
|
id = object.read_attribute_for_serialization(embed_key)
|
||||||
if polymorphic?
|
if polymorphic?
|
||||||
{
|
{
|
||||||
:type => polymorphic_key,
|
:type => polymorphic_key,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user