remove dynamic class creation where not needed (#1850)

* remove dynamic class creation where not needed
This commit is contained in:
L. Preston Sego III
2016-07-18 15:11:09 -04:00
committed by Benjamin Fleischer
parent 3ad2457aaf
commit aa4d89ab47
14 changed files with 90 additions and 85 deletions

View File

@@ -4,7 +4,10 @@ module ActiveModelSerializers
module Adapter
class JsonApi
class FieldsTest < ActiveSupport::TestCase
Post = Class.new(::Model)
class Post < ::Model; end
class Author < ::Model; end
class Comment < ::Model; end
class PostSerializer < ActiveModel::Serializer
type 'posts'
attributes :title, :body
@@ -12,13 +15,11 @@ module ActiveModelSerializers
has_many :comments
end
Author = Class.new(::Model)
class AuthorSerializer < ActiveModel::Serializer
type 'authors'
attributes :name, :birthday
end
Comment = Class.new(::Model)
class CommentSerializer < ActiveModel::Serializer
type 'comments'
attributes :body