mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
allow singular embed when serializing association
Having ```ruby has_one :post, embed: :ids ``` looks especially weird as it's a one-to-one association, hence there is only one id. The following looks better: ```ruby has_one :post, embed: :id ```
This commit is contained in:
parent
22d72f76bc
commit
e8ae3e1bb3
@ -72,11 +72,11 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def embed_ids?
|
||||
option(:embed, source_serializer._embed) == :ids
|
||||
[:id, :ids].include? option(:embed, source_serializer._embed)
|
||||
end
|
||||
|
||||
def embed_objects?
|
||||
option(:embed, source_serializer._embed) == :objects
|
||||
[:object, :objects].include? option(:embed, source_serializer._embed)
|
||||
end
|
||||
|
||||
def embed_in_root?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user