Class: SchoolSelectionInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
app/inputs/school_selection_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options) ⇒ Object



2
3
4
5
6
7
8
# File 'app/inputs/school_selection_input.rb', line 2

def input(wrapper_options)
  merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)
  input_name = attribute_name.to_s.gsub(/_id/, '_name')
  value = options[:value] || @builder.object.send(attribute_name).blank? ? '' : @builder.object.school.name
  text_field_options = merged_input_options.merge(data: { school_picker: true }, name: "#{object_name}[#{input_name}]", value: value)
  template.text_field(input_name, value, text_field_options)
end