mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Revert "Speed up integer casting from DB"
This reverts commit52fddcc653
.52fddcc
was to short-circuit `ensure_in_range` in `cast_value`. But that caused a regression for empty string deserialization. Since7c6f393
, `ensure_in_range` is moved into `serialize`. As52fddcc
said, the absolute gain is quite small. So I've reverted that commit to fix the regression.
This commit is contained in:
parent
8e66548b08
commit
9c9c950d02
2 changed files with 1 additions and 6 deletions
|
@ -18,11 +18,6 @@ module ActiveModel
|
|||
:integer
|
||||
end
|
||||
|
||||
def deserialize(value)
|
||||
return if value.nil?
|
||||
value.to_i
|
||||
end
|
||||
|
||||
def serialize(value)
|
||||
result = super
|
||||
if result
|
||||
|
|
|
@ -54,7 +54,7 @@ module ActiveModel
|
|||
type = Type::Integer.new
|
||||
assert_nil type.cast("")
|
||||
assert_nil type.serialize("")
|
||||
assert_equal 0, type.deserialize("")
|
||||
assert_nil type.deserialize("")
|
||||
end
|
||||
|
||||
test "changed?" do
|
||||
|
|
Loading…
Reference in a new issue