README.md in cheap_ams-0.10.5 vs README.md in cheap_ams-0.10.6

- old
+ new

@@ -1,10 +1,12 @@ # ActiveModel::Serializer -[![Build Status](https://travis-ci.org/rails-api/active_model_serializers.svg)](https://travis-ci.org/rails-api/active_model_serializers) +[![Build Status](https://travis-ci.org/rails-api/active_model_serializers.svg)](https://travis-ci.org/rails-api/active_model_serializers) +<a href="https://codeclimate.com/github/rails-api/active_model_serializers"><img src="https://codeclimate.com/github/rails-api/active_model_serializers/badges/gpa.svg" /></a> +<a href="https://codeclimate.com/github/rails-api/active_model_serializers/coverage"><img src="https://codeclimate.com/github/rails-api/active_model_serializers/badges/coverage.svg" /></a> -_Windows Build Status -_ ![Build Status](https://ci.appveyor.com/api/projects/status/1dly7uj4l69bchmu) +_Windows Build Status -_ [![Build status](https://ci.appveyor.com/api/projects/status/x6xdjydutm54gvyt/branch/master?svg=true)](https://ci.appveyor.com/project/joaomdmoura/active-model-serializers/branch/master) ActiveModel::Serializer brings convention over configuration to your JSON generation. AMS does this through two components: **serializers** and **adapters**. Serializers describe _which_ attributes and relationships should be serialized. @@ -32,24 +34,20 @@ class PostSerializer < ActiveModel::Serializer cache key: 'posts', expires_in: 3.hours attributes :title, :body has_many :comments - - url :post end ``` and ```ruby class CommentSerializer < ActiveModel::Serializer attributes :name, :body belongs_to :post - - url [:post, :comment] end ``` Generally speaking, you as a user of AMS will write (or generate) these serializer classes. If you want to use a different adapter, such as a JsonApi, you can @@ -235,24 +233,20 @@ class PostSerializer < ActiveModel::Serializer attributes :title, :body has_many :comments has_one :author - - url :post end ``` and ```ruby class CommentSerializer < ActiveModel::Serializer attributes :name, :body belongs_to :post_id - - url [:post, :comment] end ``` The attribute names are a **whitelist** of attributes to be serialized. @@ -270,12 +264,10 @@ ```ruby has_many :comments, key: :reviews ``` -The `url` declaration describes which named routes to use while generating URLs -for your JSON. Not every adapter will require URLs. ## Pagination Pagination links will be included in your response automatically as long as the resource is paginated using [Kaminari](https://github.com/amatsuda/kaminari) or [WillPaginate](https://github.com/mislav/will_paginate) and if you are using a ```JSON-API``` adapter. Although the others adapters does not have this feature, it is possible to implement pagination links to `JSON` adapter. For more information about it, please see in our docs [How to add pagination links](https://github.com/rails-api/active_model_serializers/blob/master/docs/howto/add_pagination_links.md) @@ -303,12 +295,10 @@ class PostSerializer < ActiveModel::Serializer cache key: 'post', expires_in: 3.hours attributes :title, :body has_many :comments - - url :post end ``` On this example every ```Post``` object will be cached with the key ```"post/#{post.id}-#{post.updated_at}"```. You can use this key to expire it as you want, @@ -328,11 +318,9 @@ class PostSerializer < ActiveModel::Serializer cache key: 'post', expires_in: 3.hours, only: [:title] attributes :title, :body has_many :comments - - url :post end ``` ## Getting Help