class ActiveModel::Type::Boolean
-
All other values will be coerced to
true.
- Empty strings are coerced tonil.FALSE_VALUESwill be coerced tofalse.
-"false","f","0",0or any other value in
user input.
A class that behaves like a boolean type, including rules for coercion of
= Active Model Boolean Type
def cast_value(value)
def cast_value(value) if value == "" nil else !FALSE_VALUES.include?(value) end end
def serialize(value) # :nodoc:
def serialize(value) # :nodoc: cast(value) end
def serialize_cast_value(value) # :nodoc:
def serialize_cast_value(value) # :nodoc: value end
def type # :nodoc:
def type # :nodoc: :boolean end