class Formular::Element::Checkbox

Public Instance Methods

hidden_tag() click to toggle source
# File lib/formular/elements.rb, line 311
def hidden_tag
  return '' unless options[:include_hidden]

  Hidden.(value: options[:unchecked_value], name: options[:name]).to_s
end

Private Instance Methods

collection_base_options() click to toggle source
Calls superclass method
# File lib/formular/elements.rb, line 334
def collection_base_options
  super.merge(include_hidden: false)
end
default_checked_value() click to toggle source
# File lib/formular/elements.rb, line 319
def default_checked_value
  options[:checked_value] || '1'
end
default_unchecked_value() click to toggle source
# File lib/formular/elements.rb, line 323
def default_unchecked_value
  collection? ? '' : '0'
end
form_encoded_name() click to toggle source

only append the [] to name if part of a collection, or the multiple option is set

Calls superclass method
# File lib/formular/elements.rb, line 328
def form_encoded_name
  return unless path

  options[:multiple] || options[:collection] ? super + '[]' : super
end