Do not leak the Errors default proc when calling to_hash or as_json
#26640

casperisfine wants to merge Shopify:fix-am-errors-to-hash-default-proc into rails:master

We do not currently have an analysis of these two commits