diff options
Diffstat (limited to 'config/initializers')
| -rw-r--r-- | config/initializers/postgresql_adapter_patch.rb | 68 | ||||
| -rw-r--r-- | config/initializers/squeel.rb | 6 |
2 files changed, 37 insertions, 37 deletions
diff --git a/config/initializers/postgresql_adapter_patch.rb b/config/initializers/postgresql_adapter_patch.rb index 2e4d73f85..3c6530bef 100644 --- a/config/initializers/postgresql_adapter_patch.rb +++ b/config/initializers/postgresql_adapter_patch.rb @@ -14,41 +14,41 @@ # Add missing double-quote to write array of daterange in SQL query # See #1782 -class ActiveRecord::ConnectionAdapters::PostgreSQLColumn +# class ActiveRecord::ConnectionAdapters::PostgreSQLColumn - def self.array_to_string(value, column, adapter) - casted_values = value.map do |val| - if String === val - if val == "NULL" - "\"#{val}\"" - else - quote_and_escape(adapter.type_cast(val, column, true)) - end - elsif Range === val - casted_value = adapter.type_cast(val, column, true) - "\"#{casted_value}\"" - else - adapter.type_cast(val, column, true) - end - end - "{#{casted_values.join(',')}}" - end +# def self.array_to_string(value, column, adapter) +# casted_values = value.map do |val| +# if String === val +# if val == "NULL" +# "\"#{val}\"" +# else +# quote_and_escape(adapter.type_cast(val, column, true)) +# end +# elsif Range === val +# casted_value = adapter.type_cast(val, column, true) +# "\"#{casted_value}\"" +# else +# adapter.type_cast(val, column, true) +# end +# end +# "{#{casted_values.join(',')}}" +# end -end +# end -module ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID - class DateRange < Range - # Unnormalize daterange - # [2016-11-19,2016-12-26) -> 2016-11-19..2016-12-25 - def type_cast(value) - result = super value +# module ActiveRecord::ConnectionAdapters::PostgreSQLAdapter::OID +# class DateRange < Range +# # Unnormalize daterange +# # [2016-11-19,2016-12-26) -> 2016-11-19..2016-12-25 +# def type_cast(value) +# result = super value - if result.respond_to?(:exclude_end?) && result.exclude_end? - ::Range.new(result.begin, result.end - 1, false) - else - result - end - end - end - register_type 'daterange', DateRange.new(:date) -end +# if result.respond_to?(:exclude_end?) && result.exclude_end? +# ::Range.new(result.begin, result.end - 1, false) +# else +# result +# end +# end +# end +# register_type 'daterange', DateRange.new(:date) +# end diff --git a/config/initializers/squeel.rb b/config/initializers/squeel.rb index 821e72952..9fb8b24b2 100644 --- a/config/initializers/squeel.rb +++ b/config/initializers/squeel.rb @@ -1,8 +1,8 @@ -Squeel.configure do |config| +# Squeel.configure do |config| # To load hash extensions (to allow for AND (&), OR (|), and NOT (-) against # hashes of conditions): # - config.load_core_extensions :hash + # config.load_core_extensions :hash # To load symbol extensions (for a subset of the old MetaWhere functionality, # via Arel predicate methods on Symbols: :name.matches, etc): @@ -21,4 +21,4 @@ Squeel.configure do |config| # "less_than_any" and "less_than_all" as well: # # config.alias_predicate :less_than, :lt -end +# end |
