From 7178b9de7bf02c66338807839a7f031e2021a94b Mon Sep 17 00:00:00 2001 From: Scott Kobewka Date: Wed, 17 Aug 2016 20:23:28 -0400 Subject: [PATCH] Documenting Adapter. Fixing typo in association.rb documentation. --- CHANGELOG.md | 2 ++ docs/general/rendering.md | 6 +++++- lib/active_model/serializer/association.rb | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 751da693..2d23784f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,8 @@ Misc: - [#1878](https://github.com/rails-api/active_model_serializers/pull/1878) Cache key generation for serializers now uses `ActiveSupport::Cache.expand_cache_key` instead of `Array#join` by default and is also overridable. This change should be backward-compatible. (@markiz) +- [#1799](https://github.com/rails-api/active_model_serializers/pull/1799) Add documentation for setting the adapter. (@ScottKbka) + ### [v0.10.2 (2016-07-05)](https://github.com/rails-api/active_model_serializers/compare/v0.10.1...v0.10.2) Fixes: diff --git a/docs/general/rendering.md b/docs/general/rendering.md index 7237c6a5..72392dd2 100644 --- a/docs/general/rendering.md +++ b/docs/general/rendering.md @@ -82,7 +82,11 @@ See [Fields](fields.md) for more information. #### adapter -PR please :) +This option lets you explicitly set the adapter to be used by passing a registered adapter. Your options are `:attributes`, `:json`, and `:json_api`. + +``` +ActiveModel::Serializer.config.adapter = :json_api +``` #### key_transform diff --git a/lib/active_model/serializer/association.rb b/lib/active_model/serializer/association.rb index 02ac7606..9dca6722 100644 --- a/lib/active_model/serializer/association.rb +++ b/lib/active_model/serializer/association.rb @@ -1,6 +1,6 @@ module ActiveModel class Serializer - # This class hold all information about serializer's association. + # This class holds all information about serializer's association. # # @attr [Symbol] name # @attr [ActiveModel::Serializer] serializer