diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-10 11:06:55 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-06-10 11:06:55 -0300 |
commit | bfb8b139aaeecd3aaadb99c3f483c1420e59c384 (patch) | |
tree | d7d5ded07b5ecf6311da1355dea5add5f4f0f1e3 /activerecord/lib/active_record/connection_adapters/postgresql/column.rb | |
parent | 4b8d0b803f454058eb363a101b512b98e4ec198d (diff) | |
parent | b5aa210bf75eacb86d423f677991aef1468cb3c6 (diff) | |
download | rails-bfb8b139aaeecd3aaadb99c3f483c1420e59c384.tar.gz rails-bfb8b139aaeecd3aaadb99c3f483c1420e59c384.tar.bz2 rails-bfb8b139aaeecd3aaadb99c3f483c1420e59c384.zip |
Merge pull request #15607 from sgrif/sg-array-type-cast
Inline PG array type casting helper
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/column.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/column.rb | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb index a579746815..847fd4dded 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb @@ -4,6 +4,8 @@ module ActiveRecord module ConnectionAdapters # PostgreSQL-specific extensions to column definitions in a table. class PostgreSQLColumn < Column #:nodoc: + extend PostgreSQL::Cast + attr_accessor :array def initialize(name, default, cast_type, sql_type = nil, null = true, default_function = nil) @@ -17,24 +19,6 @@ module ActiveRecord @default_function = default_function end - - # :stopdoc: - class << self - include PostgreSQL::Cast - - # 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 - end - # :startdoc: end end end |