mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Add support for dynamic string-links in JsonApi adapter.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user