Skip to content

Commit 6da52c6

Browse files
committed
Remove listings from the serialization guide that won't make 3.2.
1 parent 8896b4f commit 6da52c6

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

railties/guides/source/serializers.textile

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -459,25 +459,6 @@ In other words, if a +PostSerializer+ is trying to serialize comments, it will f
459459
look for +PostSerializer::CommentSerializer+ before falling back to +CommentSerializer+
460460
and finally +comment.as_json+.
461461

462-
h3. Optional Associations
463-
464-
In some cases, you will want to allow a front-end to decide whether to include associated
465-
content or not. You can achieve this easily by making an association *optional*.
466-
467-
<ruby>
468-
class PostSerializer < ActiveModel::Serializer
469-
attributes :title. :body
470-
has_many :comments, :optional => true
471-
472-
# ...
473-
end
474-
</ruby>
475-
476-
If an association is optional, it will not be included unless the request asks for it
477-
with an +including+ parameter. The +including+ parameter is a comma-separated list of
478-
optional associations to include. If the +including+ parameter includes an association
479-
you did not specify in your serializer, it will receive a +401 Forbidden+ response.
480-
481462
h3. Overriding the Defaults
482463

483464
h4. Authorization Scope
@@ -500,24 +481,6 @@ which allows you to define a dynamic authorization scope based on the current re
500481

501482
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.
502483

503-
h4. Parameter to Specify Included Optional Associations
504-
505-
In most cases, you should be able to use the default +including+ parameter to specify
506-
which optional associations to include. If you are already using that parameter name or
507-
want to reserve it for some reason, you can specify a different name by using the
508-
+serialization_includes_param+ class method.
509-
510-
<ruby>
511-
class PostsController < ApplicationController
512-
serialization_includes_param :associations_to_include
513-
end
514-
</ruby>
515-
516-
You can also implement a +serialization_includes+ instance method, which should return an
517-
Array of optional includes.
518-
519-
WARNING: If you implement +serialization_includes+ and return an invalid association, your user will receive a +401 Forbidden+ exception.
520-
521484
h3. Using Serializers Outside of a Request
522485

523486
The serialization API encapsulates the concern of generating a JSON representation of

0 commit comments

Comments
 (0)