Expected Behavior
I am trying to find a way to run decorate on the object being serialized once instead of each time I use the object in an attribute definition. Ultimately I am looking for access to the object prior to any attribute methods being called.
Actual Behavior
Currently I have to call decorate multiple times instead of once for all attribute definitions:
attribute :full_name do |object|
object.decorate.full_name
end
attribute :phone_numbers |object|
object.decorate.phone_numbers
end
Steps to Reproduce the Problem
- Define a serializer
- Call decorate in each attribute definition block
- Performance degrades
Specifications
- Version: 2.2.0
- Ruby version: 2.5.8
Expected Behavior
I am trying to find a way to run
decorateon the object being serialized once instead of each time I use the object in an attribute definition. Ultimately I am looking for access to the object prior to any attribute methods being called.Actual Behavior
Currently I have to call decorate multiple times instead of once for all attribute definitions:
Steps to Reproduce the Problem
Specifications