From 6567989ad7ba5dc994c7d820f7f9d2191bc067a8 Mon Sep 17 00:00:00 2001 From: Leo Correa Date: Wed, 27 Jul 2016 14:59:12 -0400 Subject: [PATCH] Specify how to get the instance of the serializer (#1861) [DOC] `SerializableResource#serializer` vs. `SerializableResource#serializer_instance` [ci skip] --- docs/howto/outside_controller_use.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/howto/outside_controller_use.md b/docs/howto/outside_controller_use.md index 07517c7e..3eb60f30 100644 --- a/docs/howto/outside_controller_use.md +++ b/docs/howto/outside_controller_use.md @@ -22,7 +22,7 @@ model_json = serializable_resource.as_json ### Looking up the Serializer for a Resource -If you want to retrieve a serializer for a specific resource, you can do the following: +If you want to retrieve the serializer class for a specific resource, you can do the following: ```ruby # Create our resource @@ -41,7 +41,13 @@ You could also retrieve the serializer via: ActiveModelSerializers::SerializableResource.new(post, options).serializer ``` -Both approaches will return an instance, if any, of the resource's serializer. +Both approaches will return the serializer class that will be used for the resource. + +Additionally, you could retrieve the serializer instance for the resource via: + +```ruby +ActiveModelSerializers::SerializableResource.new(post, options).serializer_instance +``` ## Serializing before controller render