Better AMS Model attributes interface

This commit is contained in:
Benjamin Fleischer
2016-11-20 23:25:09 -06:00
parent cd09e89006
commit 772b7999c5
12 changed files with 21 additions and 15 deletions

View File

@@ -2,16 +2,16 @@ require 'test_helper'
module SerializationScopeTesting
class User < ActiveModelSerializers::Model
attr_accessor :id, :name, :admin
attributes :id, :name, :admin
def admin?
admin
end
end
class Comment < ActiveModelSerializers::Model
attr_accessor :id, :body
attributes :id, :body
end
class Post < ActiveModelSerializers::Model
attr_accessor :id, :title, :body, :comments
attributes :id, :title, :body, :comments
end
class PostSerializer < ActiveModel::Serializer
attributes :id, :title, :body, :comments