rails/rails — pull request #11477 by alno (2013-07-17 15:21:26+00:00)
Title: Fix array values escaping: backslashes should be escaped too

Current array escaping doesn't escape backslashes, leading to failures like:

ActiveRecord::StatementInvalid: PG::Error: ERROR: malformed array literal: "{"this has","some \\"s that need to be escaped\""}"
: INSERT INTO "pg_arrays" ("tags") VALUES ($1) RETURNING "id"

This patch fixes it. Correct escaping regexp is taken from [this line](https://github.com/rails/rails/blob/232d2223ebcfe5c9e0425c821f5d30a7d5968512/activerecord/lib/active_record/connection_adapters/postgresql/cast.rb#L73)