class ActiveModel::Type::Boolean

  • All other values will be coerced to true.
    - Empty strings are coerced to nil.
    FALSE_VALUES will be coerced to false.
    - "false", "f", "0", 0 or 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:

:nodoc:
def serialize(value) # :nodoc:
  cast(value)
end

def serialize_cast_value(value) # :nodoc:

:nodoc:
def serialize_cast_value(value) # :nodoc:
  value
end

def type # :nodoc:

:nodoc:
def type # :nodoc:
  :boolean
end