activesupport 4.1.0.beta2 → 4.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +166 -8
- data/MIT-LICENSE +1 -1
- data/lib/active_support.rb +1 -1
- data/lib/active_support/cache.rb +2 -2
- data/lib/active_support/cache/mem_cache_store.rb +6 -8
- data/lib/active_support/cache/strategy/local_cache.rb +8 -2
- data/lib/active_support/callbacks.rb +1 -1
- data/lib/active_support/configurable.rb +1 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +0 -15
- data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +14 -0
- data/lib/active_support/core_ext/class/delegating_attributes.rb +9 -8
- data/lib/active_support/core_ext/date/conversions.rb +5 -2
- data/lib/active_support/core_ext/date_time/calculations.rb +5 -1
- data/lib/active_support/core_ext/enumerable.rb +1 -1
- data/lib/active_support/core_ext/hash.rb +1 -0
- data/lib/active_support/core_ext/hash/compact.rb +20 -0
- data/lib/active_support/core_ext/hash/conversions.rb +1 -1
- data/lib/active_support/core_ext/hash/except.rb +1 -1
- data/lib/active_support/core_ext/hash/keys.rb +6 -6
- data/lib/active_support/core_ext/module/attr_internal.rb +2 -1
- data/lib/active_support/core_ext/module/concerning.rb +1 -1
- data/lib/active_support/core_ext/module/delegation.rb +22 -20
- data/lib/active_support/core_ext/object/blank.rb +43 -17
- data/lib/active_support/core_ext/object/inclusion.rb +12 -0
- data/lib/active_support/core_ext/object/json.rb +4 -4
- data/lib/active_support/core_ext/object/to_param.rb +7 -3
- data/lib/active_support/core_ext/object/to_query.rb +6 -1
- data/lib/active_support/core_ext/range/each.rb +1 -2
- data/lib/active_support/core_ext/string/access.rb +1 -1
- data/lib/active_support/core_ext/string/output_safety.rb +12 -12
- data/lib/active_support/core_ext/thread.rb +1 -1
- data/lib/active_support/core_ext/time/calculations.rb +6 -4
- data/lib/active_support/dependencies.rb +10 -1
- data/lib/active_support/hash_with_indifferent_access.rb +7 -3
- data/lib/active_support/i18n_railtie.rb +1 -1
- data/lib/active_support/inflections.rb +6 -0
- data/lib/active_support/inflector/methods.rb +1 -1
- data/lib/active_support/json/encoding.rb +7 -1
- data/lib/active_support/key_generator.rb +7 -9
- data/lib/active_support/message_encryptor.rb +1 -1
- data/lib/active_support/multibyte/unicode.rb +36 -36
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +37 -7
- data/lib/active_support/ordered_hash.rb +4 -0
- data/lib/active_support/testing/isolation.rb +2 -0
- data/lib/active_support/testing/time_helpers.rb +84 -12
- data/lib/active_support/time_with_zone.rb +8 -7
- data/lib/active_support/values/time_zone.rb +9 -21
- data/lib/active_support/values/unicode_tables.dat +0 -0
- data/lib/active_support/version.rb +1 -1
- data/lib/active_support/xml_mini.rb +4 -2
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87a46d55993c7fe10cc8ba6a01d4474d7066ae02
|
4
|
+
data.tar.gz: 9b0148f8a1f14cae020e29bc96c5ef94892ec170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f5d24838b7c3b27cddda961dc881e0a319e39970c74ba353ac0e5bdc1fa080509452fe6a6ad2c5bf018fca83da3861da98755fcee65a7115b9914ff9ba3ab9d
|
7
|
+
data.tar.gz: 45372e3716334f5afd51512fe9b566e1b150a8864d836c3dea23ce245709d6ddd97870ab0cd00c483230a3e34a67f1e81b7f13a79af4f4e43ec32c80b1f5d788
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,159 @@
|
|
1
|
+
* Added `Object#present_in` to simplify value whitelisting.
|
2
|
+
|
3
|
+
Before:
|
4
|
+
|
5
|
+
params[:bucket_type].in?(%w( project calendar )) ? params[:bucket_type] : nil
|
6
|
+
|
7
|
+
After:
|
8
|
+
|
9
|
+
params[:bucket_type].present_in %w( project calendar )
|
10
|
+
|
11
|
+
*DHH*
|
12
|
+
|
13
|
+
* Time helpers honor the application time zone when passed a date.
|
14
|
+
|
15
|
+
*Xavier Noria*
|
16
|
+
|
17
|
+
* Fix the implementation of Multibyte::Unicode.tidy_bytes for JRuby
|
18
|
+
|
19
|
+
The existing implementation caused JRuby to raise the error:
|
20
|
+
`Encoding::ConverterNotFoundError: code converter not found (UTF-8 to UTF8-MAC)`
|
21
|
+
|
22
|
+
*Justin Coyne*
|
23
|
+
|
24
|
+
* Fix `to_param` behavior when there are nested empty hashes.
|
25
|
+
|
26
|
+
Before:
|
27
|
+
|
28
|
+
params = {c: 3, d: {}}.to_param # => "&c=3"
|
29
|
+
|
30
|
+
After:
|
31
|
+
|
32
|
+
params = {c: 3, d: {}}.to_param # => "c=3&d="
|
33
|
+
|
34
|
+
Fixes #13892.
|
35
|
+
|
36
|
+
*Hincu Petru*
|
37
|
+
|
38
|
+
* Deprecate custom `BigDecimal` serialization.
|
39
|
+
|
40
|
+
Deprecate the custom `BigDecimal` serialization that is included when requiring
|
41
|
+
`active_support/all` as a fix for #12467. Let Ruby handle YAML serialization
|
42
|
+
for `BigDecimal` instead.
|
43
|
+
|
44
|
+
*David Celis*
|
45
|
+
|
46
|
+
* Fix parsing bugs in `XmlMini`
|
47
|
+
|
48
|
+
Symbols or boolean parsing would raise an error for non string values (e.g.
|
49
|
+
integers). Decimal parsing would fail due to a missing requirement.
|
50
|
+
|
51
|
+
*Birkir A. Barkarson*
|
52
|
+
|
53
|
+
* Maintain the current timezone when calling `wrap_with_time_zone`
|
54
|
+
|
55
|
+
Extend the solution from the fix for #12163 to the general case where `Time`
|
56
|
+
methods are wrapped with a time zone.
|
57
|
+
|
58
|
+
Fixes #12596.
|
59
|
+
|
60
|
+
*Andrew White*
|
61
|
+
|
62
|
+
* Remove behavior that automatically remove the Date/Time stubs, added by `travel`
|
63
|
+
and `travel_to` methods, after each test case.
|
64
|
+
|
65
|
+
Now users have to use the `travel_back` or the block version of `travel` and
|
66
|
+
`travel_to` methods to clean the stubs.
|
67
|
+
|
68
|
+
*Rafael Mendonça França*
|
69
|
+
|
70
|
+
* Add `travel_back` to remove stubs from `travel` and `travel_to`.
|
71
|
+
|
72
|
+
*Rafael Mendonça França*
|
73
|
+
|
74
|
+
* Remove the deprecation about the `#filter` method.
|
75
|
+
|
76
|
+
Filter objects should now rely on method corresponding to the filter type
|
77
|
+
(e.g. `#before`).
|
78
|
+
|
79
|
+
*Aaron Patterson*
|
80
|
+
|
81
|
+
* Add `ActiveSupport::JSON::Encoding.time_precision` as a way to configure the
|
82
|
+
precision of encoded time values:
|
83
|
+
|
84
|
+
Time.utc(2000, 1, 1).as_json # => "2000-01-01T00:00:00.000Z"
|
85
|
+
ActiveSupport::JSON::Encoding.time_precision = 0
|
86
|
+
Time.utc(2000, 1, 1).as_json # => "2000-01-01T00:00:00Z"
|
87
|
+
|
88
|
+
*Parker Selbert*
|
89
|
+
|
90
|
+
* Maintain the current timezone when calling `change` during DST overlap
|
91
|
+
|
92
|
+
Currently if a time is changed during DST overlap in the autumn then the method
|
93
|
+
`period_for_local` will return the DST period. However if the original time is
|
94
|
+
not DST then this can be surprising and is not what is generally wanted. This
|
95
|
+
commit changes that behavior to maintain the current period if it's in the list
|
96
|
+
of periods returned by `periods_for_local`.
|
97
|
+
|
98
|
+
Fixes #12163.
|
99
|
+
|
100
|
+
*Andrew White*
|
101
|
+
|
102
|
+
* Added `Hash#compact` and `Hash#compact!` for removing items with nil value
|
103
|
+
from hash.
|
104
|
+
|
105
|
+
*Celestino Gomes*
|
106
|
+
|
107
|
+
* Maintain proleptic gregorian in Time#advance
|
108
|
+
|
109
|
+
`Time#advance` uses `Time#to_date` and `Date#advance` to calculate a new date.
|
110
|
+
The `Date` object returned by `Time#to_date` is constructed with the assumption
|
111
|
+
that the `Time` object represents a proleptic gregorian date, but it is
|
112
|
+
configured to observe the default julian calendar reform date (2299161j)
|
113
|
+
for purposes of calculating month, date and year:
|
114
|
+
|
115
|
+
Time.new(1582, 10, 4).to_date.to_s # => "1582-09-24"
|
116
|
+
Time.new(1582, 10, 4).to_date.gregorian.to_s # => "1582-10-04"
|
117
|
+
|
118
|
+
This patch ensures that when the intermediate `Date` object is advanced
|
119
|
+
to yield a new `Date` object, that the `Time` object for return is constructed
|
120
|
+
with a proleptic gregorian month, date and year.
|
121
|
+
|
122
|
+
*Riley Lynch*
|
123
|
+
|
124
|
+
* `MemCacheStore` should only accept a `Dalli::Client`, or create one.
|
125
|
+
|
126
|
+
*arthurnn*
|
127
|
+
|
128
|
+
* Don't lazy load the `tzinfo` library as it causes problems on Windows.
|
129
|
+
|
130
|
+
Fixes #13553.
|
131
|
+
|
132
|
+
*Andrew White*
|
133
|
+
|
134
|
+
* Use `remove_possible_method` instead of `remove_method` to avoid
|
135
|
+
a `NameError` to be thrown on FreeBSD with the `Date` object.
|
136
|
+
|
137
|
+
*Rafael Mendonça França*, *Robin Dupret*
|
138
|
+
|
139
|
+
* `blank?` and `present?` commit to return singletons.
|
140
|
+
|
141
|
+
*Xavier Noria*, *Pavel Pravosud*
|
142
|
+
|
143
|
+
* Fixed Float related error in NumberHelper with large precisions.
|
144
|
+
|
145
|
+
Before:
|
146
|
+
|
147
|
+
ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
|
148
|
+
#=> "3.14158999999999988261834005243144929409027099609375"
|
149
|
+
|
150
|
+
After:
|
151
|
+
|
152
|
+
ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50
|
153
|
+
#=> "3.14159000000000000000000000000000000000000000000000"
|
154
|
+
|
155
|
+
*Kenta Murata*, *Akira Matsuda*
|
156
|
+
|
1
157
|
* Default the new `I18n.enforce_available_locales` config to `true`, meaning
|
2
158
|
`I18n` will make sure that all locales passed to it must be declared in the
|
3
159
|
`available_locales` list.
|
@@ -318,19 +474,21 @@
|
|
318
474
|
|
319
475
|
The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical
|
320
476
|
estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on
|
321
|
-
1.9.3 and 2.0.
|
477
|
+
1.9.3 and 2.0.
|
478
|
+
|
479
|
+
Fixes #11512.
|
322
480
|
|
323
481
|
*Simeon Simeonov*
|
324
482
|
|
325
483
|
* Only raise `Module::DelegationError` if it's the source of the exception.
|
326
484
|
|
327
|
-
Fixes #10559
|
485
|
+
Fixes #10559.
|
328
486
|
|
329
487
|
*Andrew White*
|
330
488
|
|
331
489
|
* Make `Time.at_with_coercion` retain the second fraction and return local time.
|
332
490
|
|
333
|
-
Fixes #11350
|
491
|
+
Fixes #11350.
|
334
492
|
|
335
493
|
*Neer Friedman*, *Andrew White*
|
336
494
|
|
@@ -347,7 +505,7 @@
|
|
347
505
|
|
348
506
|
*Arun Agrawal*
|
349
507
|
|
350
|
-
* Remove deprecated `DateTime.local_offset` in favor of `DateTime.
|
508
|
+
* Remove deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_format`.
|
351
509
|
|
352
510
|
*Arun Agrawal*
|
353
511
|
|
@@ -396,21 +554,21 @@
|
|
396
554
|
* Fix return value from `BacktraceCleaner#noise` when the cleaner is configured
|
397
555
|
with multiple silencers.
|
398
556
|
|
399
|
-
Fixes #11030
|
557
|
+
Fixes #11030.
|
400
558
|
|
401
559
|
*Mark J. Titorenko*
|
402
560
|
|
403
561
|
* `HashWithIndifferentAccess#select` now returns a `HashWithIndifferentAccess`
|
404
562
|
instance instead of a `Hash` instance.
|
405
563
|
|
406
|
-
Fixes #10723
|
564
|
+
Fixes #10723.
|
407
565
|
|
408
566
|
*Albert Llop*
|
409
567
|
|
410
568
|
* Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps
|
411
569
|
sub-second resolution when wrapping a `DateTime` value.
|
412
570
|
|
413
|
-
Fixes #10855
|
571
|
+
Fixes #10855.
|
414
572
|
|
415
573
|
*Andrew White*
|
416
574
|
|
@@ -426,7 +584,7 @@
|
|
426
584
|
* Prevent side effects to hashes inside arrays when
|
427
585
|
`Hash#with_indifferent_access` is called.
|
428
586
|
|
429
|
-
Fixes #10526
|
587
|
+
Fixes #10526.
|
430
588
|
|
431
589
|
*Yves Senn*
|
432
590
|
|
data/MIT-LICENSE
CHANGED
data/lib/active_support.rb
CHANGED
data/lib/active_support/cache.rb
CHANGED
@@ -401,7 +401,7 @@ module ActiveSupport
|
|
401
401
|
end
|
402
402
|
end
|
403
403
|
|
404
|
-
#
|
404
|
+
# Returns +true+ if the cache contains an entry for the given key.
|
405
405
|
#
|
406
406
|
# Options are passed to the underlying cache implementation.
|
407
407
|
def exist?(name, options = nil)
|
@@ -452,7 +452,7 @@ module ActiveSupport
|
|
452
452
|
# Clear the entire cache. Be careful with this method since it could
|
453
453
|
# affect other processes if shared cache is being used.
|
454
454
|
#
|
455
|
-
#
|
455
|
+
# The options hash is passed to the underlying cache implementation.
|
456
456
|
#
|
457
457
|
# All implementations may not support this method.
|
458
458
|
def clear(options = nil)
|
@@ -41,17 +41,15 @@ module ActiveSupport
|
|
41
41
|
#
|
42
42
|
# If no addresses are specified, then MemCacheStore will connect to
|
43
43
|
# localhost port 11211 (the default memcached port).
|
44
|
-
#
|
45
|
-
# Instead of addresses one can pass in a MemCache-like object. For example:
|
46
|
-
#
|
47
|
-
# require 'memcached' # gem install memcached; uses C bindings to libmemcached
|
48
|
-
# ActiveSupport::Cache::MemCacheStore.new(Memcached::Rails.new("localhost:11211"))
|
49
44
|
def initialize(*addresses)
|
50
45
|
addresses = addresses.flatten
|
51
46
|
options = addresses.extract_options!
|
52
47
|
super(options)
|
53
48
|
|
54
|
-
|
49
|
+
unless [String, Dalli::Client, NilClass].include?(addresses.first.class)
|
50
|
+
raise ArgumentError, "First argument must be an empty array, an array of hosts or a Dalli::Client instance."
|
51
|
+
end
|
52
|
+
if addresses.first.is_a?(Dalli::Client)
|
55
53
|
@data = addresses.first
|
56
54
|
else
|
57
55
|
mem_cache_options = options.dup
|
@@ -87,7 +85,7 @@ module ActiveSupport
|
|
87
85
|
instrument(:increment, name, :amount => amount) do
|
88
86
|
@data.incr(escape_key(namespaced_key(name, options)), amount)
|
89
87
|
end
|
90
|
-
rescue Dalli::DalliError
|
88
|
+
rescue Dalli::DalliError => e
|
91
89
|
logger.error("DalliError (#{e}): #{e.message}") if logger
|
92
90
|
nil
|
93
91
|
end
|
@@ -101,7 +99,7 @@ module ActiveSupport
|
|
101
99
|
instrument(:decrement, name, :amount => amount) do
|
102
100
|
@data.decr(escape_key(namespaced_key(name, options)), amount)
|
103
101
|
end
|
104
|
-
rescue Dalli::DalliError
|
102
|
+
rescue Dalli::DalliError => e
|
105
103
|
logger.error("DalliError (#{e}): #{e.message}") if logger
|
106
104
|
nil
|
107
105
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'active_support/core_ext/object/duplicable'
|
2
2
|
require 'active_support/core_ext/string/inflections'
|
3
|
+
require 'rack/body_proxy'
|
3
4
|
|
4
5
|
module ActiveSupport
|
5
6
|
module Cache
|
@@ -83,9 +84,14 @@ module ActiveSupport
|
|
83
84
|
|
84
85
|
def call(env)
|
85
86
|
LocalCacheRegistry.set_cache_for(local_cache_key, LocalStore.new)
|
86
|
-
@app.call(env)
|
87
|
-
|
87
|
+
response = @app.call(env)
|
88
|
+
response[2] = ::Rack::BodyProxy.new(response[2]) do
|
89
|
+
LocalCacheRegistry.set_cache_for(local_cache_key, nil)
|
90
|
+
end
|
91
|
+
response
|
92
|
+
rescue Exception
|
88
93
|
LocalCacheRegistry.set_cache_for(local_cache_key, nil)
|
94
|
+
raise
|
89
95
|
end
|
90
96
|
end
|
91
97
|
|
@@ -577,7 +577,7 @@ module ActiveSupport
|
|
577
577
|
# The callback can be specified as a symbol naming an instance method; as a
|
578
578
|
# proc, lambda, or block; as a string to be instance evaluated; or as an
|
579
579
|
# object that responds to a certain method determined by the <tt>:scope</tt>
|
580
|
-
# argument to +
|
580
|
+
# argument to +define_callbacks+.
|
581
581
|
#
|
582
582
|
# If a proc, lambda, or block is given, its body is evaluated in the context
|
583
583
|
# of the current object. It can also optionally accept the current object as
|
@@ -107,7 +107,7 @@ module ActiveSupport
|
|
107
107
|
options = names.extract_options!
|
108
108
|
|
109
109
|
names.each do |name|
|
110
|
-
raise NameError.new('invalid config attribute name') unless name =~
|
110
|
+
raise NameError.new('invalid config attribute name') unless name =~ /\A[_A-Za-z]\w*\z/
|
111
111
|
|
112
112
|
reader, reader_line = "def #{name}; config.#{name}; end", __LINE__
|
113
113
|
writer, writer_line = "def #{name}=(value); config.#{name} = value; end", __LINE__
|
@@ -1,22 +1,7 @@
|
|
1
1
|
require 'bigdecimal'
|
2
2
|
require 'bigdecimal/util'
|
3
|
-
require 'yaml'
|
4
3
|
|
5
4
|
class BigDecimal
|
6
|
-
YAML_MAPPING = { 'Infinity' => '.Inf', '-Infinity' => '-.Inf', 'NaN' => '.NaN' }
|
7
|
-
|
8
|
-
def encode_with(coder)
|
9
|
-
string = to_s
|
10
|
-
coder.represent_scalar(nil, YAML_MAPPING[string] || string)
|
11
|
-
end
|
12
|
-
|
13
|
-
# Backport this method if it doesn't exist
|
14
|
-
unless method_defined?(:to_d)
|
15
|
-
def to_d
|
16
|
-
self
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
5
|
DEFAULT_STRING_FORMAT = 'F'
|
21
6
|
def to_formatted_s(*args)
|
22
7
|
if args[0].is_a?(Symbol)
|
@@ -0,0 +1,14 @@
|
|
1
|
+
ActiveSupport::Deprecation.warn 'core_ext/big_decimal/yaml_conversions is deprecated and will be removed in the future.'
|
2
|
+
|
3
|
+
require 'bigdecimal'
|
4
|
+
require 'yaml'
|
5
|
+
require 'active_support/core_ext/big_decimal/conversions'
|
6
|
+
|
7
|
+
class BigDecimal
|
8
|
+
YAML_MAPPING = { 'Infinity' => '.Inf', '-Infinity' => '-.Inf', 'NaN' => '.NaN' }
|
9
|
+
|
10
|
+
def encode_with(coder)
|
11
|
+
string = to_s
|
12
|
+
coder.represent_scalar(nil, YAML_MAPPING[string] || string)
|
13
|
+
end
|
14
|
+
end
|
@@ -4,20 +4,21 @@ require 'active_support/core_ext/module/remove_method'
|
|
4
4
|
class Class
|
5
5
|
def superclass_delegating_accessor(name, options = {})
|
6
6
|
# Create private _name and _name= methods that can still be used if the public
|
7
|
-
# methods are overridden.
|
8
|
-
_superclass_delegating_accessor("_#{name}")
|
7
|
+
# methods are overridden.
|
8
|
+
_superclass_delegating_accessor("_#{name}", options)
|
9
9
|
|
10
|
-
# Generate the public methods name, name=, and name
|
10
|
+
# Generate the public methods name, name=, and name?.
|
11
11
|
# These methods dispatch to the private _name, and _name= methods, making them
|
12
|
-
# overridable
|
12
|
+
# overridable.
|
13
13
|
singleton_class.send(:define_method, name) { send("_#{name}") }
|
14
14
|
singleton_class.send(:define_method, "#{name}?") { !!send("_#{name}") }
|
15
15
|
singleton_class.send(:define_method, "#{name}=") { |value| send("_#{name}=", value) }
|
16
16
|
|
17
|
-
# If an instance_reader is needed, generate methods
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
# If an instance_reader is needed, generate public instance methods name and name?.
|
18
|
+
if options[:instance_reader] != false
|
19
|
+
define_method(name) { send("_#{name}") }
|
20
|
+
define_method("#{name}?") { !!send("#{name}") }
|
21
|
+
end
|
21
22
|
end
|
22
23
|
|
23
24
|
private
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'date'
|
2
2
|
require 'active_support/inflector/methods'
|
3
3
|
require 'active_support/core_ext/date/zones'
|
4
|
+
require 'active_support/core_ext/module/remove_method'
|
4
5
|
|
5
6
|
class Date
|
6
7
|
DATE_FORMATS = {
|
@@ -19,8 +20,10 @@ class Date
|
|
19
20
|
# Ruby 1.9 has Date#to_time which converts to localtime only.
|
20
21
|
remove_method :to_time
|
21
22
|
|
22
|
-
# Ruby 1.9 has Date#xmlschema which converts to a string without the time
|
23
|
-
|
23
|
+
# Ruby 1.9 has Date#xmlschema which converts to a string without the time
|
24
|
+
# component. This removal may generate an issue on FreeBSD, that's why we
|
25
|
+
# need to use remove_possible_method here
|
26
|
+
remove_possible_method :xmlschema
|
24
27
|
|
25
28
|
# Convert to a formatted string. See DATE_FORMATS for predefined formats.
|
26
29
|
#
|
@@ -151,7 +151,11 @@ class DateTime
|
|
151
151
|
# Layers additional behavior on DateTime#<=> so that Time and
|
152
152
|
# ActiveSupport::TimeWithZone instances can be compared with a DateTime.
|
153
153
|
def <=>(other)
|
154
|
-
|
154
|
+
if other.respond_to? :to_datetime
|
155
|
+
super other.to_datetime
|
156
|
+
else
|
157
|
+
nil
|
158
|
+
end
|
155
159
|
end
|
156
160
|
|
157
161
|
end
|