mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Remove traces of embed option.
This commit is contained in:
parent
64168cbecd
commit
c5446d759f
@ -7,7 +7,7 @@ module ActiveModel
|
|||||||
# @param [Hash{Symbol => Object}] options
|
# @param [Hash{Symbol => Object}] options
|
||||||
#
|
#
|
||||||
# @example
|
# @example
|
||||||
# Association.new(:comments, CommentSummarySerializer, embed: :ids)
|
# Association.new(:comments, CommentSummarySerializer)
|
||||||
#
|
#
|
||||||
Association = Struct.new(:name, :serializer, :options) do
|
Association = Struct.new(:name, :serializer, :options) do
|
||||||
|
|
||||||
|
|||||||
4
test/fixtures/poro.rb
vendored
4
test/fixtures/poro.rb
vendored
@ -136,8 +136,8 @@ AuthorSerializer = Class.new(ActiveModel::Serializer) do
|
|||||||
cache key:'writer', skip_digest: true
|
cache key:'writer', skip_digest: true
|
||||||
attributes :id, :name
|
attributes :id, :name
|
||||||
|
|
||||||
has_many :posts, embed: :ids
|
has_many :posts
|
||||||
has_many :roles, embed: :ids
|
has_many :roles
|
||||||
has_one :bio
|
has_one :bio
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -6,7 +6,7 @@ module ActiveModel
|
|||||||
AuthorSummarySerializer = Class.new
|
AuthorSummarySerializer = Class.new
|
||||||
class AssociationsTestSerializer < Serializer
|
class AssociationsTestSerializer < Serializer
|
||||||
belongs_to :author, serializer: AuthorSummarySerializer
|
belongs_to :author, serializer: AuthorSummarySerializer
|
||||||
has_many :comments, embed: :ids
|
has_many :comments
|
||||||
has_one :category
|
has_one :category
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ module ActiveModel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_has_many_defines_reflection
|
def test_has_many_defines_reflection
|
||||||
has_many_reflection = HasManyReflection.new(:comments, embed: :ids)
|
has_many_reflection = HasManyReflection.new(:comments, {})
|
||||||
|
|
||||||
assert_includes(@reflections, has_many_reflection)
|
assert_includes(@reflections, has_many_reflection)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -52,13 +52,13 @@ module ActiveModel
|
|||||||
|
|
||||||
case key
|
case key
|
||||||
when :posts
|
when :posts
|
||||||
assert_equal({ embed: :ids }, options)
|
assert_equal({}, options)
|
||||||
assert_kind_of(ActiveModel::Serializer.config.array_serializer, serializer)
|
assert_kind_of(ActiveModel::Serializer.config.array_serializer, serializer)
|
||||||
when :bio
|
when :bio
|
||||||
assert_equal({}, options)
|
assert_equal({}, options)
|
||||||
assert_nil serializer
|
assert_nil serializer
|
||||||
when :roles
|
when :roles
|
||||||
assert_equal({ embed: :ids }, options)
|
assert_equal({}, options)
|
||||||
assert_kind_of(ActiveModel::Serializer.config.array_serializer, serializer)
|
assert_kind_of(ActiveModel::Serializer.config.array_serializer, serializer)
|
||||||
else
|
else
|
||||||
flunk "Unknown association: #{key}"
|
flunk "Unknown association: #{key}"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user