instance method
cast
Ruby on Rails 7.2.3
Since v5.2.8.1Signature
cast(value)
Type casts a value from user input (e.g. from a setter). This value may be a string from the form builder, or a ruby object passed to a setter. There is currently no way to differentiate between which source it came from.
The return value of this method will be returned from ActiveRecord::AttributeMethods::Read#read_attribute. See also: Value#cast_value.
value The raw input, as provided to the attribute setter.
Parameters
-
valuereq
Source
# File activemodel/lib/active_model/type/value.rb, line 57
def cast(value)
cast_value(value) unless value.nil?
end
Defined in activemodel/lib/active_model/type/value.rb line 57
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveModel::Type::Value