mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Reuse ivar
This commit is contained in:
@@ -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' },
|
||||||
|
|||||||
Reference in New Issue
Block a user