mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-24 14:56:50 +00:00
Reuse ivar
This commit is contained in:
parent
04f8c0c16f
commit
d2f2508825
@ -86,7 +86,7 @@ module ActiveModel
|
|||||||
CONFIG.embed = :ids
|
CONFIG.embed = :ids
|
||||||
CONFIG.include = true
|
CONFIG.include = true
|
||||||
|
|
||||||
PostSerializer._associations[:comments].send :initialize, @association.name, @association.options
|
@association.send :initialize, @association.name, @association.options
|
||||||
|
|
||||||
assert_equal({
|
assert_equal({
|
||||||
'post' => { title: 'Title 1', body: 'Body 1', 'comment_ids' => @post.comments.map { |c| c.object_id } },
|
'post' => { title: 'Title 1', body: 'Body 1', 'comment_ids' => @post.comments.map { |c| c.object_id } },
|
||||||
@ -100,7 +100,7 @@ module ActiveModel
|
|||||||
CONFIG.embed = nil
|
CONFIG.embed = nil
|
||||||
CONFIG.include = true
|
CONFIG.include = true
|
||||||
|
|
||||||
PostSerializer._associations[:comments].send :initialize, @association.name, @association.options
|
@association.send :initialize, @association.name, @association.options
|
||||||
|
|
||||||
assert_equal({
|
assert_equal({
|
||||||
'post' => { title: 'Title 1', body: 'Body 1' },
|
'post' => { title: 'Title 1', body: 'Body 1' },
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user