# File app/helpers/application_helper.rb, line 212
    def auto_field(field, options={})
      column = @object.class.columns.select { |col| 
        col.name.to_s == field.to_s}.first

      # To check for specially treated fields, we need the field to be
      # a string (not a symbol, as it is usually specified)
      field = field.to_s

      if !column
        if @object.respond_to?(field) and 
            @object.connection.tables.include?(field) and
            model = field.camelcase.singularize.constantize
          # HABTM relation
          return checkbox_group(field, model.find(:all), options)
        else
          # Don't know how to handle this
          raise(NoMethodError,
                _('Field %s not defined for %s') % [field, @object.class])
        end
      end

      # Specially treated fields
      if field == 'id'
        return info_row(field, options)

      elsif field == 'passwd'
        options[:value] = ''
        return password_field(field, options)

      elsif field =~ /_id$/ and column.type == :integer and
          model = table_from_field(field)
        # field_id and there is a corresponding table? Present the catalog.
        choices = model.qualified_collection_by_id
        return select(field, 
                      choices.map {|it| [Translation.for(it[0]), it[1]]},
                      {:include_blank => true})
      end

      # Generic fields, based on data type
      case column.type.to_sym
      when :string
        return text_field(field, options) 

      when :text
        options[:size] ||= '70x15'
        return text_area(field, options) 

      when :integer, :decimal, :float
        options[:class] ||= 'numeric'
        return text_field(field, options)

      when :boolean
        return radio_group(field, [[_('Yes'), true], [_('No'), false]], 
                           options)

      when :date
        return date_field(field, options)

      when :datetime
        return datetime_select(field, options)

      else
        # What is it, then? just report it...
        return info_row(field, options)

      end

    end