mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
value is always a link
This commit is contained in:
parent
ca6c009273
commit
572f11b7e0
@ -482,11 +482,8 @@ module ActiveModelSerializers
|
|||||||
# }.reject! {|_,v| v.nil? }
|
# }.reject! {|_,v| v.nil? }
|
||||||
def links_for(serializer)
|
def links_for(serializer)
|
||||||
serializer._links.each_with_object({}) do |(name, value), hash|
|
serializer._links.each_with_object({}) do |(name, value), hash|
|
||||||
if value.is_a?(ActiveModel::Serializer::Link)
|
|
||||||
next if value.excluded?(serializer)
|
next if value.excluded?(serializer)
|
||||||
value = value.block
|
result = Link.new(serializer, value.block).as_json
|
||||||
end
|
|
||||||
result = Link.new(serializer, value).as_json
|
|
||||||
hash[name] = result if result
|
hash[name] = result if result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user