class

ActiveModel::Type::Boolean

rails latest stable - Superclass: ActiveModel::Type::Value

Active Model Boolean Type

A class that behaves like a boolean type, including rules for coercion of user input.

  • "false", "f", "0", 0 or any other value in FALSE_VALUES will be coerced to false.

  • Empty strings are coerced to nil.

  • All other values will be coerced to true.

Constants

FALSE_VALUES = [\nfalse, 0,\n"0", :"0",\n"f", :f,\n"F", :F,\n"false", :false,\n"FALSE", :FALSE,\n"off", :off,\n"OFF", :OFF,\n].to_set.freeze

Files

  • activemodel/lib/active_model/type/boolean.rb