Class Lafcadio::BooleanField
In: lafcadio/objectField.rb
Parent: ObjectField

BooleanField represents a boolean value. By default, it assumes that the table field represents true and false with the integers 1 and 0. There are two different ways to change this default.

First, BooleanField includes a few enumerated defaults. Currently there are only

  * :one_zero (the default, uses integers 1 and 0)
  * :capital_yes_no (uses characters 'Y' and 'N')
  * :raw_true_false (uses unquoted values 'true' and 'false')

In a class definition, this would look like

  class User < Lafcadio::DomainObject
    boolean 'administrator', { 'enum_type' => :capital_yes_no }

For more fine-grained specification you can pass a hash with the keys true and false using the argument enums.

  class User < Lafcadio::DomainObject
    boolean 'administrator',
            { 'enums' => { true => 'yin', false => 'yang' } }

enums takes precedence over enum_type.



enum_type  [RW] 
enums  [W] 

Public Class methods

Public Instance methods