From 1b6ccbbe7bb52c31daeaa4e0464a597c646e5c50 Mon Sep 17 00:00:00 2001 From: Kevin Tham Date: Thu, 10 Jan 2013 10:02:38 -0800 Subject: [PATCH] Update association section on README.md to reflect deprecation of the prefix of the serializer class being used as the accessor to the object we wish to serialize. (reason was previously that the name of the object being serialized is not necessarily going to be the prefix of the serializer class and worse the prefix could have been an attribute of the object itself) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 925a41f2..2a6b1082 100644 --- a/README.md +++ b/README.md @@ -280,7 +280,7 @@ class PostSerializer < ActiveModel::Serializer # only let the user see comments he created. def comments - post.comments.where(:created_by => scope) + object.comments.where(:created_by => scope) end end ``` @@ -307,7 +307,7 @@ class PostSerializer < ActiveModel::Serializer has_many :comments def include_comments? - !post.comments_disabled? + !object.comments_disabled? end end ```