def collection_select(attribute, collection, value_method, text_method, options={}, html_options={})
if value_method.respond_to?(:call) || text_method.respond_to?(:call)
collection = collection.map do |item|
value = value_for_collection(item, value_method)
text = value_for_collection(item, text_method)
default_html_options = default_html_options_for_collection(item, value, options, html_options)
disabled = value if default_html_options[:disabled]
selected = value if default_html_options[:selected]
[value, text, selected, disabled]
end
[:disabled, :selected].each do |option|
option_value = collection.map(&:pop).compact
options[option] = option_value if option_value.present?
end
value_method, text_method = :first, :last
end
original_collection_select(attribute, collection, value_method, text_method, options, html_options)
end