README.md in active_model_serializers-0.9.3 vs README.md in active_model_serializers-0.9.4

- old
+ new

@@ -337,10 +337,11 @@ And it's also safe to mutate keys argument by doing keys.delete(:author) in case you want to avoid creating two extra arrays. Note that if you do an in-place modification, you still need to return the modified array. +### Alias Attribute If you would like the key in the outputted JSON to be different from its name in ActiveRecord, you can declare the attribute with the different name and redefine that method: ```ruby @@ -753,22 +754,22 @@ "post": { "id": 1, "title": "New post", "attachments": [ { - "type": "image" + "type": "image", "image": { - "id": 3 - "name": "logo" + "id": 3, + "name": "logo", "url": "http://images.com/logo.jpg" } }, { - "type": "video" + "type": "video", "video": { - "id": 12 - "uid": "XCSSMDFWW" + "id": 12, + "uid": "XCSSMDFWW", "source": "youtube" } } ] } @@ -791,14 +792,14 @@ "post": { "id": 1, "title": "New post", "attachment_ids": [ { - "type": "image" + "type": "image", "id": 12 }, { - "type": "video" + "type": "video", "id": 3 } ] } }