diff --git a/README.md b/README.md index 903560b0..1fe9da16 100644 --- a/README.md +++ b/README.md @@ -328,35 +328,11 @@ class PostSerializer < ActiveModel::Serializer end ``` -Use the `:serializer` option to specify a custom serializer class: +You may also use the `:serializer` option to specify a custom serializer class and the `:polymorphic` option to specify an association that is polymorphic (STI), e.g.: ```ruby -class PostSerializer < ActiveModel::Serializer - attributes :id, :title, :body - has_one :author has_many :comments, :serializer => CommentShortSerializer - - def include_associations! - include! :author if scope.admin? - include! :comments unless object.comments_disabled? - end -end -``` - -Use the `:polymorphic` option to specify an association that is polymorphic (STI): - -```ruby -class PostSerializer < ActiveModel::Serializer - attributes :id, :title, :body - has_one :author - has_many :comments has_one :reviewer, :polymorphic => true - - def include_associations! - include! :author if scope.admin? - include! :comments unless object.comments_disabled? - end -end ``` ## Embedding Associations