method
option_text_and_value
v3.1.0 -
Show latest stable
- Class:
ActionView::Helpers::FormOptionsHelper
option_text_and_value(option)private
No documentation available.
# File actionpack/lib/action_view/helpers/form_options_helper.rb, line 509
def option_text_and_value(option)
# Options are [text, value] pairs or strings used for both.
case
when Array === option
option = option.reject { |e| Hash === e }
[option.first, option.last]
when !option.is_a?(String) && option.respond_to?(:first) && option.respond_to?(:last)
[option.first, option.last]
else
[option, option]
end
end