ruby-grape / grape-active_model_serializers

User active_model_serializers with Grape
MIT License
140 stars 68 forks source link

[grape 1.0.0] Json root does not exist in response. #75

Closed hikouki closed 7 years ago

hikouki commented 7 years ago

I was defined.

module V1
  class UsersAPI < Root
    resource "users" do
      desc "fetch user"
      get ':id' do
        User.find(params[:id])
      end
    end
  end
end

class V1::UserSerializer < ActiveModel::Serializer
  attributes :id, :email
end

Actual response.

{
  id: 1,
  email: "hoge@hoge.com"
}

I expected.

user: {
  id: 1,
  email: "hoge@hoge.com"
}