instance method
cast
Ruby on Rails 7.1.6
Since v7.1.6Signature
cast(value)
No documentation comment.
Parameters
-
valuereq
Source
# File activemodel/lib/active_model/type/binary.rb, line 20
def cast(value)
if value.is_a?(Data)
value.to_s
else
value = super
value = value.b if ::String === value && value.encoding != Encoding::BINARY
value
end
end
Defined in activemodel/lib/active_model/type/binary.rb line 20
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Type::Binary