Skip to content

Commit 539051b

Browse files
authored
Merge pull request #826 from knapo/dont-call-link-builder-when-custom-self-is-present
Don't call link_builder when custom link is provided
2 parents 28d062f + cbce78d commit 539051b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/jsonapi/resource_serializer.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ def meta_hash(source)
230230
end
231231

232232
def links_hash(source)
233-
{
234-
self: link_builder.self_link(source)
235-
}.merge(custom_links_hash(source)).compact
233+
links = custom_links_hash(source)
234+
links[:self] = link_builder.self_link(source) unless links.key?(:self)
235+
links.compact
236236
end
237237

238238
def custom_links_hash(source)

0 commit comments

Comments
 (0)