# File lib/formtastic.rb, line 1533
      def detect_label_and_value_method!(collection, options = {})
        sample = collection.first || collection.last

        case sample
        when Array
          label, value = :first, :last
        when Integer
          label, value = :to_s, :to_i
        when String, NilClass
          label, value = :to_s, :to_s
        end

        # Order of preference: user supplied method, class defaults, auto-detect
        label = options[:label_method] || label || collection_label_methods.find { |m| sample.respond_to?(m) }
        value = options[:value_method] || value || collection_value_methods.find { |m| sample.respond_to?(m) }

        [label, value]
      end