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:
parent
dc96825d44
commit
6efe2b4900
1 changed files with 3 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue