mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
remove dynamic class creation where not needed (#1850)
* remove dynamic class creation where not needed
This commit is contained in:
committed by
Benjamin Fleischer
parent
3ad2457aaf
commit
aa4d89ab47
@@ -5,7 +5,9 @@ module ActionController
|
||||
class JsonApi
|
||||
class KeyTransformTest < ActionController::TestCase
|
||||
class KeyTransformTestController < ActionController::Base
|
||||
Post = Class.new(::Model)
|
||||
class Post < ::Model; end
|
||||
class Author < ::Model; end
|
||||
class TopComment < ::Model; end
|
||||
class PostSerializer < ActiveModel::Serializer
|
||||
type 'posts'
|
||||
attributes :title, :body, :publish_at
|
||||
@@ -22,13 +24,11 @@ module ActionController
|
||||
end
|
||||
end
|
||||
|
||||
Author = Class.new(::Model)
|
||||
class AuthorSerializer < ActiveModel::Serializer
|
||||
type 'authors'
|
||||
attributes :first_name, :last_name
|
||||
end
|
||||
|
||||
TopComment = Class.new(::Model)
|
||||
class TopCommentSerializer < ActiveModel::Serializer
|
||||
type 'top_comments'
|
||||
attributes :body
|
||||
|
||||
Reference in New Issue
Block a user