class SimpleBootstrapForm::HorizontalForm::Fields::SelectField

Public Instance Methods

input_tag() click to toggle source
# File lib/simple_bootstrap_form/horizontal_form/fields/select_field.rb, line 6
def input_tag
  @template.content_tag(:div, class: @input_size) do
    @form_builder.select @name, choices, options, html_options
  end
end

Private Instance Methods

choices() click to toggle source
# File lib/simple_bootstrap_form/horizontal_form/fields/select_field.rb, line 22
def choices
  @template.options_for_select @collection, selected: model.send(@name)
end
html_options() click to toggle source
# File lib/simple_bootstrap_form/horizontal_form/fields/select_field.rb, line 30
def html_options
  opts = {
    class: 'form-control'
  }
  opts.merge! required: 'required' if required?
  opts
end
options() click to toggle source
# File lib/simple_bootstrap_form/horizontal_form/fields/select_field.rb, line 26
def options
  {}
end
process_options(options) click to toggle source
# File lib/simple_bootstrap_form/horizontal_form/fields/select_field.rb, line 14
def process_options(options)
  super
  @collection = @options.delete :collection
  unless @collection
    raise ":collection is a required option for select fields"
  end
end