# app/avo/resources/project.rb
class Avo::Resources::Project < Avo::BaseResource
  # ...

  def fields
    field :custom_field, as: :text

    discover_columns except: [:custom_field]
    discover_associations

    field :another_custom_field, as: :boolean
  end
end
```

## Automatic Type Mapping

Field discovery maps database column types to Avo field types automatically.
e.g.

- `string` → `:text`
- `integer` → `:number`
- `float` → `:number`
- `datetime` → `:datetime`
- `boolean` → `:boolean`
- `json/jsonb` → `:code`

The full, up-to-date list can be found [here](https://github.com/avo-hq/avo/blob/main/lib/avo/mappings.rb)

## Association Discovery

The following associations are automatically configured:

- `belongs_to` → `:belongs_to`
- `has_one` → `:has_one`
- `has_many` → `:has_many`
- `has_one_attached` → `:file`
- `has_many_attached` → `:files`
- `has_rich_text` → `:trix`
- `acts-as-taggable-on :tags` → `:tags`

The full, up-to-date list can be found [here](https://github.com/avo-hq/avo/blob/main/lib/avo/mappings.rb)

---