instance method
option_text_and_value
Ruby on Rails 3.0.20
Since v2.2.3 PrivateSignature
option_text_and_value(option)
No documentation comment.
Parameters
-
optionreq
Source
# File actionpack/lib/action_view/helpers/form_options_helper.rb, line 510
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
Defined in actionpack/lib/action_view/helpers/form_options_helper.rb line 510
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActionView::Helpers::FormOptionsHelper