diff options
| author | Robert | 2017-04-21 11:00:02 +0200 |
|---|---|---|
| committer | Robert | 2017-04-21 11:00:02 +0200 |
| commit | dc4e32c712606787c119587c7b7127841a79ab85 (patch) | |
| tree | 30078e96ede35dc35b11e0f97967ec0498ba2bf4 /config | |
| parent | 65529adbba874600660dd7003459d38ef7e03904 (diff) | |
| download | chouette-core-dc4e32c712606787c119587c7b7127841a79ab85.tar.bz2 | |
pushed postrges range semantics -> Ruby range semantics transformation - [) -> [] - into the modelwith_custom_daterange_attr
Diffstat (limited to 'config')
| -rw-r--r-- | config/initializers/postgresql_adapter_patch.rb | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/config/initializers/postgresql_adapter_patch.rb b/config/initializers/postgresql_adapter_patch.rb deleted file mode 100644 index 46066fbbf..000000000 --- a/config/initializers/postgresql_adapter_patch.rb +++ /dev/null @@ -1,24 +0,0 @@ -# Transform Wed, 22 Feb 2017...Fri, 24 Feb 201 into Wed, 22 Feb 2017..Thu, 23 Feb 201 -module ActiveRecord::ConnectionAdapters::PostgreSQL::OID - class DateRange < Range - def cast_value(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 -end - -ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do - def initialize_type_map_with_daterange mapping - initialize_type_map_without_daterange mapping - # mapping.register_type 3912, ActiveRecord::ConnectionAdapters::PostgreSQL::OID::DateRange.new(mapping.lookup('date'), :daterange) - mapping.register_type 'daterange', ActiveRecord::ConnectionAdapters::PostgreSQL::OID::DateRange.new(mapping.lookup('date'), :daterange) - end - - alias_method_chain :initialize_type_map, :daterange -end |
