Module: Surveyor::Helpers::FormtasticCustomInput

Included in:
SurveyorCheckBoxesInput, SurveyorRadioInput
Defined in:
lib/surveyor/helpers/formtastic_custom_input.rb

Instance Method Summary collapse

Instance Method Details

#input_html_options_with(choice, response_class) ⇒ Object



4
5
6
# File 'lib/surveyor/helpers/formtastic_custom_input.rb', line 4

def input_html_options_with(choice, response_class)
  input_html_options.merge(choice_html_options(choice)).merge({:id => (input_html_options[:id] || "answer_id").gsub("answer_id", response_class_to_method(response_class).to_s), :class => [input_html_options[:class], response_class].join(" ")})
end

#response_class_to_method(type_sym) ⇒ Object



7
8
9
10
# File 'lib/surveyor/helpers/formtastic_custom_input.rb', line 7

def response_class_to_method(type_sym)
  # doesn't handle response_class == answer, and doesn't have to
  "#{type_sym.to_s}_value".to_sym
end