From 5a5a5e5125debd93b1f385e7f8525caffc57f4fe Mon Sep 17 00:00:00 2001 From: Trevor Hinesley Date: Mon, 23 Jul 2018 14:31:17 -0500 Subject: [PATCH] Fixed conditional attributes documentation --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a03e1a8..d7032c1 100644 --- a/README.md +++ b/README.md @@ -351,15 +351,15 @@ class MovieSerializer include FastJsonapi::ObjectSerializer attributes :name, :year - attribute :release_year, if: Proc.new do |record| + attribute :release_year, if: Proc.new { |record| # Release year will only be serialized if it's greater than 1990 record.release_year > 1990 - end + } - attribute :director, if: Proc.new do |record, params| + attribute :director, if: Proc.new { |record, params| # The director will be serialized only if the :admin key of params is true params && params[:admin] == true - end + } end # ...