# File lib/merb_helpers/form_helpers.rb, line 486
      def options_from_collection_for_select(collection, attrs = {})
        prompt     = attrs.delete(:prompt)
        blank      = attrs.delete(:include_blank)
        ret = String.new
        if collection.is_a?(Hash)
          ret << tag("option", prompt, :value => '') if prompt
          ret << tag("option", '',     :value => '') if blank
          collection.each do |label, group|
            # .gsub(/_/, " ").gsub(/\b[a-z]/) {|x| x.upcase}) == .humanize.titleize, which is no longer in -core
            ret << open_tag("optgroup", :label => label.to_s.gsub(/_/, " ").gsub(/\b[a-z]/) {|x| x.upcase}) + 
              options_from_collection_for_select(group, attrs) + "</optgroup>"
          end
          return ret
        else
          text_method    = attrs[:text_method]
          value_method   = attrs[:value_method]
          selected_value = attrs[:selected]
          
          text_method ||= :to_s
          value_method ||= text_method
          
          options_for_select((collection || []).inject([]) { |options, object| 
              options << [ object.send(value_method), object.send(text_method) ] },
            :selected => selected_value, :include_blank => blank, :prompt => prompt
          )
        end
      end