mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Spec for linked resource type name demodulization
This commit is contained in:
15
test/fixtures/poro.rb
vendored
15
test/fixtures/poro.rb
vendored
@@ -47,6 +47,8 @@ Author = Class.new(Model)
|
||||
Bio = Class.new(Model)
|
||||
Blog = Class.new(Model)
|
||||
Role = Class.new(Model)
|
||||
module Spam; end
|
||||
Spam::UnrelatedLink = Class.new(Model)
|
||||
|
||||
PostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :title, :body, :id
|
||||
@@ -56,6 +58,15 @@ PostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
url :comments
|
||||
end
|
||||
|
||||
SpammyPostSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id
|
||||
has_many :related
|
||||
|
||||
def self.root_name
|
||||
'posts'
|
||||
end
|
||||
end
|
||||
|
||||
CommentSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id, :body
|
||||
|
||||
@@ -123,3 +134,7 @@ PostPreviewSerializer = Class.new(ActiveModel::Serializer) do
|
||||
has_many :comments, serializer: CommentPreviewSerializer
|
||||
belongs_to :author, serializer: AuthorPreviewSerializer
|
||||
end
|
||||
|
||||
Spam::UnrelatedLinkSerializer = Class.new(ActiveModel::Serializer) do
|
||||
attributes :id
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user