Skip to content
Browse files

Remove listings from the serialization guide that won't make 3.2.

  • Loading branch information...
1 parent 8896b4f commit 6da52c617e2a075b9d9e7142786f316d8f2c7930 @josevalim josevalim committed Nov 23, 2011
Showing with 0 additions and 37 deletions.
  1. +0 −37 railties/guides/source/serializers.textile
View
37 railties/guides/source/serializers.textile
@@ -459,25 +459,6 @@ In other words, if a +PostSerializer+ is trying to serialize comments, it will f
look for +PostSerializer::CommentSerializer+ before falling back to +CommentSerializer+
and finally +comment.as_json+.
-h3. Optional Associations
-
-In some cases, you will want to allow a front-end to decide whether to include associated
-content or not. You can achieve this easily by making an association *optional*.
-
-<ruby>
-class PostSerializer < ActiveModel::Serializer
- attributes :title. :body
- has_many :comments, :optional => true
-
- # ...
-end
-</ruby>
-
-If an association is optional, it will not be included unless the request asks for it
-with an +including+ parameter. The +including+ parameter is a comma-separated list of
-optional associations to include. If the +including+ parameter includes an association
-you did not specify in your serializer, it will receive a +401 Forbidden+ response.
-
h3. Overriding the Defaults
h4. Authorization Scope
@@ -500,24 +481,6 @@ which allows you to define a dynamic authorization scope based on the current re
WARNING: If you use different objects as authorization scopes, make sure that they all implement whatever interface you use in your serializers to control what the outputted JSON looks like.
-h4. Parameter to Specify Included Optional Associations
-
-In most cases, you should be able to use the default +including+ parameter to specify
-which optional associations to include. If you are already using that parameter name or
-want to reserve it for some reason, you can specify a different name by using the
-+serialization_includes_param+ class method.
-
-<ruby>
-class PostsController < ApplicationController
- serialization_includes_param :associations_to_include
-end
-</ruby>
-
-You can also implement a +serialization_includes+ instance method, which should return an
-Array of optional includes.
-
-WARNING: If you implement +serialization_includes+ and return an invalid association, your user will receive a +401 Forbidden+ exception.
-
h3. Using Serializers Outside of a Request
The serialization API encapsulates the concern of generating a JSON representation of

0 comments on commit 6da52c6

Please sign in to comment.
Something went wrong with that request. Please try again.