+ send_json err, status: status
+ end
+
+ def send_json response, opts={}
+ # The obvious render(json: ...) forces a slow JSON encoder. See
+ # #3021 and commit logs. Might be fixed in Rails 4.1.
+ render({
+ text: Oj.dump(response, mode: :compat).html_safe,
+ content_type: 'application/json'
+ }.merge opts)