class CckForms::ParameterTypeClass::Boolean
Represents a single checkbox.
Public Instance Methods
build_form(form_builder, options)
click to toggle source
Checkbox HTML
# File lib/cck_forms/parameter_type_class/boolean.rb, line 22 def build_form(form_builder, options) set_value_in_hash options form_builder.check_box :value, options.merge(value: 1, checked: value?) end
mongoize()
click to toggle source
Anything -> boolean
# File lib/cck_forms/parameter_type_class/boolean.rb, line 12 def mongoize value? end
to_s(_options = nil)
click to toggle source
'yes/no' string
# File lib/cck_forms/parameter_type_class/boolean.rb, line 17 def to_s(_options = nil) value? ? I18n.t('cck_forms.boolean.yes') : I18n.t('cck_forms.boolean.no') end
value?()
click to toggle source
Is it true?
# File lib/cck_forms/parameter_type_class/boolean.rb, line 7 def value? value.present? && value != '0' end