Skip to content

Commit

Permalink
Add info on has_many association extra option (#255)
Browse files Browse the repository at this point in the history
* Add info on has_many association extra option

* Update docs

* Add a gif

* Use new gif

* Update docs/3.0/associations/has_many.md

Co-authored-by: Paul Bob <[email protected]>

* Use new gif

---------

Co-authored-by: Paul Bob <[email protected]>
  • Loading branch information
binarygit and Paul-Bob authored Aug 6, 2024
1 parent 790c99a commit 63ca8b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/3.0/associations/has_many.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,23 @@ 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
}
```

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

<!-- @include: ./../common/show_on_edit_common.md-->
<!-- @include: ./../common/scopes_common.md-->
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 63ca8b3

Please sign in to comment.