Merge pull request #34899 from rails/speed-up-step
Duration#coerce should always return a Scalar
This commit is contained in:
commit
28bb21bf5a
|
@ -214,8 +214,11 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def coerce(other) #:nodoc:
|
||||
if Scalar === other
|
||||
case other
|
||||
when Scalar
|
||||
[other, self]
|
||||
when Duration
|
||||
[Scalar.new(other.value), self]
|
||||
else
|
||||
[Scalar.new(other), self]
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue