1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use type.serializable? in unboundable?

This commit is contained in:
Ryuta Kamizono 2021-03-09 09:19:35 +09:00
parent dc96825d44
commit 6efe2b4900

View file

@ -31,14 +31,10 @@ module ActiveRecord
end
def unboundable?
if defined?(@_unboundable)
@_unboundable
else
value_for_database unless value_before_type_cast.is_a?(StatementCache::Substitute)
@_unboundable = nil
unless defined?(@_unboundable)
@_unboundable = !type.serializable?(value) && type.cast(value) <=> 0
end
rescue ::RangeError
@_unboundable = type.cast(value_before_type_cast) <=> 0
@_unboundable
end
private