Add support for dynamic string-links in JsonApi adapter.

This commit is contained in:
Lucas Hosseini
2015-12-29 20:02:32 +01:00
parent 316026e9ce
commit 30d8414cce
4 changed files with 25 additions and 17 deletions

View File

@@ -210,15 +210,7 @@ module ActiveModel
def links_for(serializer)
serializer._links.each_with_object({}) do |(name, value), hash|
hash[name] =
if value.respond_to?(:call)
link = Link.new(serializer)
link.instance_eval(&value)
link.to_hash
else
value
end
hash[name] = Link.new(serializer, value).as_json
end
end