mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
added failing spec to show how both symbol and string keys are causing problems
This commit is contained in:
12
test/fixtures/poro.rb
vendored
12
test/fixtures/poro.rb
vendored
@@ -47,6 +47,12 @@ class Post < Model
|
||||
end
|
||||
end
|
||||
|
||||
class SpecialPost < Post
|
||||
def special_comment
|
||||
@speical_comment ||= Comment.new(content: 'special')
|
||||
end
|
||||
end
|
||||
|
||||
class Comment < Model
|
||||
end
|
||||
|
||||
@@ -110,6 +116,12 @@ class PostSerializer < ActiveModel::Serializer
|
||||
has_many :comments
|
||||
end
|
||||
|
||||
class SpecialPostSerializer < ActiveModel::Serializer
|
||||
attributes :title, :body
|
||||
has_many :comments, root: :comments, embed_in_root: true, embed: :ids
|
||||
has_one :special_comment, root: :comments, embed_in_root: true, embed: :ids
|
||||
end
|
||||
|
||||
class CommentSerializer < ActiveModel::Serializer
|
||||
attributes :content
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user