diff options
author | kares <self@kares.org> | 2014-05-13 18:51:34 +0200 |
---|---|---|
committer | kares <self@kares.org> | 2014-05-13 18:51:34 +0200 |
commit | f8d1845fc50ee4467ff156a8edadc39d7d0f2926 (patch) | |
tree | 9f8e5df15f68656b06d341273ecff92d4f2f9792 /activerecord/lib/active_record/connection_adapters/postgresql/column.rb | |
parent | 0b2eee453c20ad9b725a97d145fa59d49dcd6a92 (diff) | |
download | rails-f8d1845fc50ee4467ff156a8edadc39d7d0f2926.tar.gz rails-f8d1845fc50ee4467ff156a8edadc39d7d0f2926.tar.bz2 rails-f8d1845fc50ee4467ff156a8edadc39d7d0f2926.zip |
[postgres] include PgArrayParser directly and only load/include ArrayParser if not found
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters/postgresql/column.rb')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql/column.rb | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb index 1d22b56964..82785825e5 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/column.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/column.rb @@ -29,8 +29,20 @@ module ActiveRecord # :stopdoc: class << self - include ConnectionAdapters::PostgreSQLColumn::Cast - include ConnectionAdapters::PostgreSQLColumn::ArrayParser + include PostgreSQLColumn::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 PostgreSQLColumn::ArrayParser + end + attr_accessor :money_precision end # :startdoc: |