Skip to content

Commit 5a5a5e5

Browse files
TrevorHinesleyshishirmk
authored andcommitted
Fixed conditional attributes documentation
1 parent 4012507 commit 5a5a5e5

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,15 @@ class MovieSerializer
351351
include FastJsonapi::ObjectSerializer
352352

353353
attributes :name, :year
354-
attribute :release_year, if: Proc.new do |record|
354+
attribute :release_year, if: Proc.new { |record|
355355
# Release year will only be serialized if it's greater than 1990
356356
record.release_year > 1990
357-
end
357+
}
358358

359-
attribute :director, if: Proc.new do |record, params|
359+
attribute :director, if: Proc.new { |record, params|
360360
# The director will be serialized only if the :admin key of params is true
361361
params && params[:admin] == true
362-
end
362+
}
363363
end
364364

365365
# ...

0 commit comments

Comments
 (0)