@@ -46,18 +46,18 @@ def meta
46
46
end
47
47
48
48
def object
49
- @object ||= @wip_isolated_options [ :association_options ] . fetch ( :reflection ) .
50
- value (
51
- @wip_isolated_options [ :association_options ] . fetch ( :parent_serializer ) ,
52
- @wip_isolated_options [ :association_options ] . fetch ( :include_slice )
53
- )
49
+ @object ||= @wip_isolated_options [ :association_options ] . fetch ( :reflection )
50
+ . value (
51
+ @wip_isolated_options [ :association_options ] . fetch ( :parent_serializer ) ,
52
+ @wip_isolated_options [ :association_options ] . fetch ( :include_slice )
53
+ )
54
54
end
55
- alias eval_reflection_block object
55
+ alias_method : eval_reflection_block, : object
56
56
57
57
def include_data?
58
58
eval_reflection_block if @wip_isolated_options [ :association_options ] . fetch ( :reflection ) . block
59
- @wip_isolated_options [ :association_options ] . fetch ( :reflection ) .
60
- include_data? ( @wip_isolated_options [ :association_options ] . fetch ( :include_slice ) )
59
+ @wip_isolated_options [ :association_options ] . fetch ( :reflection )
60
+ . include_data? ( @wip_isolated_options [ :association_options ] . fetch ( :include_slice ) )
61
61
end
62
62
63
63
# @return [ActiveModel::Serializer, nil]
@@ -93,6 +93,8 @@ def serialize_object!(object)
93
93
end
94
94
end
95
95
96
+ # NOTE(BF): This serializer throw/catch should only happen when the serializer is a collection
97
+ # serializer. This is a good reason for the reflection to have a to_many? type method.
96
98
def instantiate_serializer ( object )
97
99
serializer = catch ( :no_serializer ) do
98
100
serializer_options = @wip_isolated_options [ :association_options ] . fetch ( :parent_serializer_options ) . except ( :serializer )
0 commit comments