@@ -161,7 +161,7 @@ def attributes
161
161
end
162
162
end
163
163
164
- def associations
164
+ def associations ( options = { } )
165
165
associations = self . class . _associations
166
166
included_associations = filter ( associations . keys )
167
167
associations . each_with_object ( { } ) do |( name , association ) , hash |
@@ -178,7 +178,7 @@ def associations
178
178
if association . embed_namespace?
179
179
hash = hash [ association . embed_namespace ] ||= { }
180
180
end
181
- hash [ association . embedded_key ] = serialize association
181
+ hash [ association . embedded_key ] = serialize association , options
182
182
end
183
183
end
184
184
end
@@ -236,8 +236,8 @@ def association_options_for_serializer(association)
236
236
end
237
237
end
238
238
239
- def serialize ( association )
240
- build_serializer ( association ) . serializable_object
239
+ def serialize ( association , options = { } )
240
+ build_serializer ( association ) . serializable_object ( options )
241
241
end
242
242
243
243
def serialize_ids ( association )
@@ -282,7 +282,7 @@ def serializable_object(options={})
282
282
self . serialization_options = options
283
283
return @wrap_in_array ? [ ] : nil if @object . nil?
284
284
hash = attributes
285
- hash . merge! associations
285
+ hash . merge! associations ( options )
286
286
hash = convert_keys ( hash ) if key_format . present?
287
287
hash = { :type => type_name ( @object ) , type_name ( @object ) => hash } if @polymorphic
288
288
@wrap_in_array ? [ hash ] : hash
0 commit comments