Class: Bureaucrat::Fields::NullBooleanField

Inherits:
BooleanField show all
Defined in:
lib/bureaucrat/fields.rb

Instance Attribute Summary

Attributes inherited from Field

#error_messages, #help_text, #hidden_widget, #initial, #label, #required, #show_hidden_initial, #validators, #widget

Instance Method Summary collapse

Methods inherited from Field

#bound_data, #clean, #default_error_messages, #default_hidden_widget, #default_validators, #initialize, #initialize_copy, #populate_object, #prepare_value, #run_validators, #widget_attrs

Constructor Details

This class inherits a constructor from Bureaucrat::Fields::Field

Instance Method Details

#default_widgetObject



505
506
507
# File 'lib/bureaucrat/fields.rb', line 505

def default_widget
  Widgets::NullBooleanSelect
end

#to_object(value) ⇒ Object



509
510
511
512
513
514
515
# File 'lib/bureaucrat/fields.rb', line 509

def to_object(value)
  case value
  when true, 'true', '1', 'on' then true
  when false, 'false', '0' then false
  else nil
  end
end

#validate(value) ⇒ Object



517
518
# File 'lib/bureaucrat/fields.rb', line 517

def validate(value)
end