Open
Description
I've tried getting it to serialize ActiveModel errors, but to no avail.
Here's what I've got going on..
I've tried both of these for good measure.
# /api/v1/defaults.rb
error_formatter :json, Grape::Formatter::ActiveModelSerializers
error_formatter :jsonapi, Grape::Formatter::ActiveModelSerializers
# api/v1/users.rb, includes defaults
params do
requires :id, types: String, desc: 'User ID'
end
route_param :id do
before do
@user = User.where(id: params[:id]).first!
end
desc 'Update a user'
params do
optional :first_name, type: String, desc: 'First Name'
optional :last_name, type: String, desc: 'Last Name'
optional :email, type: String, desc: 'Email Address'
end
patch do
@user.update(params)
end
end
Any suggestions greatly appreciated!