Method: ActiveModel::Type::Value#cast
- Defined in:
- activemodel/lib/active_model/type/value.rb
#cast(value) ⇒ Object
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.
57 58 59 |
# File 'activemodel/lib/active_model/type/value.rb', line 57 def cast(value) cast_value(value) unless value.nil? end |