diff options
author | Sean Griffin <sean@thoughtbot.com> | 2014-06-17 17:05:34 -0600 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2014-06-17 17:47:57 -0600 |
commit | ba29c28a47c8a8016f32cad8b7fcc6dbd0e06162 (patch) | |
tree | 97d739d6a0ae02ca88d18586c7ba8fdf2f6e0b95 /activerecord/lib | |
parent | 7f7e2f12ab835526c6914843b983619ed12c9b68 (diff) | |
download | rails-ba29c28a47c8a8016f32cad8b7fcc6dbd0e06162.tar.gz rails-ba29c28a47c8a8016f32cad8b7fcc6dbd0e06162.tar.bz2 rails-ba29c28a47c8a8016f32cad8b7fcc6dbd0e06162.zip |
Detect mutations of arrays and array members
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb index 63f3be45de..d322c56acc 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid/array.rb @@ -3,6 +3,20 @@ module ActiveRecord module PostgreSQL module OID # :nodoc: class Array < Type::Value + include Type::Mutable + + # Loads pg_array_parser if available. String parsing can be + # performed quicker by a native extension, which will not create + # a large amount of Ruby objects that will need to be garbage + # collected. pg_array_parser has a C and Java extension + begin + require 'pg_array_parser' + include PgArrayParser + rescue LoadError + require 'active_record/connection_adapters/postgresql/array_parser' + include PostgreSQL::ArrayParser + end + attr_reader :subtype, :delimiter delegate :type, to: :subtype @@ -31,18 +45,6 @@ module ActiveRecord end end - # Loads pg_array_parser if available. String parsing can be - # performed quicker by a native extension, which will not create - # a large amount of Ruby objects that will need to be garbage - # collected. pg_array_parser has a C and Java extension - begin - require 'pg_array_parser' - include PgArrayParser - rescue LoadError - require 'active_record/connection_adapters/postgresql/array_parser' - include PostgreSQL::ArrayParser - end - private def type_cast_array(value, method) |