class SimpleForm::Inputs::CollectionInput

Public Class Methods

boolean_collection() click to toggle source

Default boolean collection for use with selects/radios when no collection is given. Always fallback to this boolean collection. Texts can be translated using i18n in "simple_form.yes" and "simple_form.no" keys. See the example locale file.

# File lib/simple_form/inputs/collection_input.rb, line 8
def self.boolean_collection
  i18n_cache :boolean_collection do
    [ [I18n.t(:"simple_form.yes", :default => 'Yes'), true],
      [I18n.t(:"simple_form.no", :default => 'No'), false] ]
  end
end

Public Instance Methods

input() click to toggle source
# File lib/simple_form/inputs/collection_input.rb, line 15
def input
  raise NotImplementedError,
    "input should be implemented by classes inheriting from CollectionInput"
end
input_options() click to toggle source
# File lib/simple_form/inputs/collection_input.rb, line 20
def input_options
  options = super
  options[:include_blank] = true unless skip_include_blank?
  options
end