class ActiveModel::Type::Boolean

  • All other values will be coerced to true
    - Empty strings are coerced to nil
    - “false”, “f” , “0”, 0 or any other value in FALSE_VALUES will be coerced to false
    Coercion behavior is roughly mapped to Ruby’s boolean semantics.
    Values set from user input will first be coerced into the appropriate ruby type.
    === Coercion
    A class that behaves like a boolean type, including rules for coercion of user input.
    == Active Model Type Boolean

def cast_value(value)

def cast_value(value)
  if value == ""
    nil
  else
    !FALSE_VALUES.include?(value)
  end
end

def type # :nodoc:

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