mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Remove nil relationships links (#1833)
This commit is contained in:
@@ -13,7 +13,8 @@ module ActiveModelSerializers
|
||||
@serializable_resource_options = serializable_resource_options
|
||||
@data = data_for(serializer)
|
||||
@links = args.fetch(:links, {}).each_with_object({}) do |(key, value), hash|
|
||||
hash[key] = ActiveModelSerializers::Adapter::JsonApi::Link.new(parent_serializer, value).as_json
|
||||
result = Link.new(parent_serializer, value).as_json
|
||||
hash[key] = result if result
|
||||
end
|
||||
meta = args.fetch(:meta, nil)
|
||||
@meta = meta.respond_to?(:call) ? parent_serializer.instance_eval(&meta) : meta
|
||||
|
||||
Reference in New Issue
Block a user