# the string representation of the class
"Avo::Resources::Post"
```
</Option>

<Option name="`discreet_pagination`">

Hides the pagination details when only there's only one page for that association.

#### Default

`false`

#### Possible values

`true`, `false`
</Option>

<Option name="`hide_search_input`">

Hides the search input displayed on the association table.

#### Default

`false`. When nothing is selected and the `search_query` of association's resource is configured, Avo displays the search input.

#### Possible values

`true`, `false`.
</Option>

<Option name="`hide_filter_button`">

Hides the filters button displayed on the association table.

#### Default

`false`. The filters button is displayed by default and only hidden when `hide_filter_button` is set to `true`

#### Possible values

`true`, `false`.
</Option>
<Option name="`link_to_child_resource`">

Sets which resource should be used in an STI scenario.

See more on this in the STI section.

#### Default

`false`. When it's `false` it will use the same resource.

#### Possible values

`true`, `false`.
</Option>

## Search query scope

<VersionReq version="2.13" />

If the resource used for the `has_many` association has the `search` block configured with a `query`, Avo will use that to scope out the search query to that association.

For example, if you have a `Team` model that `has_many` `User`s, now you'll be able to search through that team's users instead of all of them.

You can target that search using `params[:via_association]`. When the value of `params[:via_association]` is `has_many`, the search has been mad inside a has_many association.

For example, if you want to show the records in a different order, you can do this:

```ruby
self.search = {
  query: -> {
    if params[:via_association] == 'has_many'
      query.ransack(id_eq: q, m: "or").result(distinct: false).order(name: :asc)
    else
      query.ransack(id_eq: q, m: "or").result(distinct: false)
    end
  }
}
```

<Option name="`linkable`">

You can add use this option to make the association title clickable. That link will open a new page with the same view.

This feature doesn't go deeper than this. It just helps you see the association table easier in a separate page.

<Image src="/assets/img/3_0/has_many/linkable.gif" width="1200" height="875" alt="" />
</Option>

## Has Many Through

The `HasMany` association also supports the `:through` option.

```ruby{3}
field :members,
  as: :has_many,
  through: :memberships
```
<Option name="`attach_fields`">

<VersionReq version="3.11" />

If you have extra fields defined in the through table and would like to display them when attaching use the `attach_fields` option.

```ruby{4,5,6}
field :patrons,
  as: :has_many,
  through: :patronships,
  attach_fields: -> {
    field :review, as: :text
  }
```

:::warning
If the through model uses **polymorphism**, the type must be included as a hidden field:

```ruby{6}
field :patrons,
  as: :has_many,
  through: :patronships,
  attach_fields: -> {
    field :review, as: :text
    field :patronship_type, as: :hidden, default: "TheType"
  }
```
:::

<Image src="/assets/img/3_0/has_many/attach-fields.gif" width="600" height="338" alt="" />
</Option>

## Show on edit screens

By default, the `{{ $frontmatter.field_type }}` field is only visible in the show view. To make it available in the edit view as well, include the `show_on: :edit` option. This ensures that the `{{ $frontmatter.field_type }}` show view component is also rendered within the edit view.

## Nested in Forms
<div class="space-x-2">
  <VersionReq version="3.19.0"/>
  <BetaStatus label="Public beta"/>
  <LicenseReq license="advanced"/>
</div>

You can use ["Show on edit screens"](#show-on-edit-screens) to make the `{{ $frontmatter.field_type }}` field available in the edit view. However, this will render it using the show view component.

To enable nested creation for the `{{ $frontmatter.field_type }}` field, allowing it to be created and / or edited alongside its parent record within the same form, use the `nested` option which is a hash with configurable option.

Keep in mind that this will display the field’s resource as it appears in the edit view.

<Option name="nested">

Enables this field as a nested form in the specified views.

##### Default value

`{}`

#### Possible values

A hash with the following options:
- `on:` Views in which to enable nesting. Accepted values:
  - `:new` - Enables nesting in the new view.
  - `:edit` - Enables nesting in the edit view.
  - `:forms` - Enables nesting in the new and edit views.
- `limit:` *(Only for `has_many` and `has_and_belongs_to_many` fields)* Hides the "Add" button when the specified limit is reached.

:::tip
Setting `nested: true` is a shortcut for `nested: { on: :forms }`.
:::

#### Example

```ruby-vue{4,5,7,8,10,11,13-14,16-19}