instance method
cast_value
Ruby on Rails edge
Since v7.1.6 Private — implementation detail, not part of the public APISignature
cast_value(value)
No documentation comment.
Parameters
-
valuereq
Source
# File activemodel/lib/active_model/type/integer.rb, line 112
def cast_value(value)
case value
when ::Integer
value
when ::String
str = value.bytesize > _limit * 4 ? value.byteslice(0, _limit * 4) : value
str.to_i rescue nil
else
value.to_i rescue nil
end
end
Defined in activemodel/lib/active_model/type/integer.rb line 112
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Type::Integer