ActiveRecord::Type::Boolean

class ActiveRecord::Type::Boolean

Parent:
Value

Active Model Type Boolean

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

Coercion

Values set from user input will first be coerced into the appropriate ruby type. Coercion behavior is roughly mapped to Ruby's boolean semantics.

  • “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

© 2004–2017 David Heinemeier Hansson
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部