class ApiResponder < ActionController::Responder
def api_behavior
raise MissingRenderer.new(format) unless has_renderer?
if delete?
head :no_content
elsif post?
display resource, status: :created
else
display resource
end
end
end
Responder should be located in app/responders/api_responder.rb
Api responder should look like:
Responder should be located in
app/responders/api_responder.rb
We should also move to:
gem 'active_model_serializers', '~> 0.10.7'
And add the following initializer code:
ActiveModelSerializers.config.adapter = :json