# app/avo/resources/course_link.rb
class Avo::Resources::CourseLink < Avo::BaseResource
  self.search = {
    query: -> {
      query.ransack(id_eq: q, link_cont: q, m: "or").result(distinct: false)
    }
  }
end
```

#### Default

`false`

#### Possible values

`true`, `false`
</Option>

<Option name="`attach_scope`">

Scope out the records the user sees on the Attach modal.

#### Default

`nil`

#### Possible values

```ruby{3}
field :user,
  as: :belongs_to,
  attach_scope: -> { query.non_admins }
```

Pass in a block where you attach scopes to the `query` object and `parent` object, which is the actual record where you want to assign the association. The block is executed in the `ExecutionContext`.
</Option>

:::warning
The `attach_scope` will not filter the records in the listing from `has_many` or `has_and_belongs_to_many` associations.
Use [`scope`](#scope) or a Pundit policy `Scope` for that.
:::

```ruby-vue{3}
field :members,
  as: :{{ $frontmatter.field_type }},
  attach_scope: -> { query.where.not(team_id: parent.id) }
  ```
In this example, in the `attach_scope`, we ensure that when attaching members to a team, only those who are not already members will appear in the list of options.

<Option name="`scope`">

Scope out the records displayed in the table.

#### Default

`nil`

#### Possible values

```ruby{3}
field :user,
  as: :belongs_to,
  scope: -> { query.approved }
```

Pass in a block where you attach scopes to the `query` object. The block gets executed in the `ExecutionContext`.

With version 2.5.0, you'll also have access to the `parent` record so that you can use that to scope your associated models even better.

Starting with version 3.12, access to `resource` and `parent_resource` was additionally provided.
</Option>

<Option name="`name`">
Changes the text displayed as association name.

![](/assets/img/associations/name-option.jpg)

#### Default

Plural association name.

#### Possible values

Any string or any zero arity lambda function.

Within lambda, you have access to all attributes of `Avo::ExecutionContext`.
</Option>

<Option name="`description`">

Changes the text displayed under the association name.

<Image src="/assets/img/associations/description-option.jpg" width="702" height="198" alt="" />

#### Default

`nil`

#### Possible values

Any string or any zero arity lambda function.

Within lambda, you have access to `query` and all attributes of `Avo::ExecutionContext`.
</Option>

<Option name="`use_resource`">

Sets a different resource to be used when displaying (or redirecting to) the association table.

#### Default

`nil`. When nothing is selected, Avo infers the resource type from the reflected association.

#### Possible values

`Avo::Resources::Post`, `Avo::Resources::PhotoComment`, or any Avo resource class.

The value can be the actual class or a string representation of that class.

```ruby