mirror of
https://github.com/samsonjs/grape-active_model_serializers.git
synced 2026-03-25 08:45:55 +00:00
should generate the proper 'root' node for individual objects should generate the proper 'root' node for serialized arrays of objects
17 lines
362 B
Ruby
17 lines
362 B
Ruby
require 'active_model'
|
|
|
|
class User < ActiveRecord::Base
|
|
attr_accessor :first_name, :last_name, :password, :email
|
|
end
|
|
|
|
class UserSerializer < ActiveModel::Serializer
|
|
attributes :first_name, :last_name
|
|
end
|
|
|
|
class BlogPost < ActiveRecord::Base
|
|
attr_accessor :title, :body
|
|
end
|
|
|
|
class BlogPostSerializer < ActiveModel::Serializer
|
|
attributes :title, :body
|
|
end
|