You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a transformer on relationships.{has_one, has_many} DSLs to automatically set `no_attributes?` to `true` if `manual` is set.
Reworks logic in places that use `no_attributes?` and `manual` together to take this new implication into consideration. (read.ex, relationships.ex, and schema.ex)
Adds some tests to ensure that this implication holds. Also adds regression tests to ensure that `select` callback for manual relationships is respected.
Copy file name to clipboardExpand all lines: documentation/dsls/DSL-Ash.Resource.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -442,7 +442,7 @@ end
442
442
443
443
| Name | Type | Default | Docs |
444
444
|------|------|---------|------|
445
-
|[`manual`](#relationships-has_one-manual){: #relationships-has_one-manual } |`(any, any -> any) \| module`|| A module that implements `Ash.Resource.ManualRelationship`. Also accepts a 2 argument function that takes the source records and the context. |
445
+
|[`manual`](#relationships-has_one-manual){: #relationships-has_one-manual } |`(any, any -> any) \| module`|| A module that implements `Ash.Resource.ManualRelationship`. Also accepts a 2 argument function that takes the source records and the context. Setting this will automatically set `no_attributes?` to `true`. |
446
446
|[`no_attributes?`](#relationships-has_one-no_attributes?){: #relationships-has_one-no_attributes? } |`boolean`|| All existing entities are considered related, i.e this relationship is not based on any fields, and `source_attribute` and `destination_attribute` are ignored. See the See the [relationships guide](/documentation/topics/resources/relationships.md) for more. |
447
447
|[`allow_nil?`](#relationships-has_one-allow_nil?){: #relationships-has_one-allow_nil? } |`boolean`|`true`| Marks the relationship as required. Has no effect on validations, but can inform extensions that there will always be a related entity. |
448
448
|[`from_many?`](#relationships-has_one-from_many?){: #relationships-has_one-from_many? } |`boolean`|`false`| Signal that this relationship is actually a `has_many` where the first record is given via the `sort`. This will allow data layers to properly deduplicate when necessary. |
@@ -544,7 +544,7 @@ end
544
544
545
545
| Name | Type | Default | Docs |
546
546
|------|------|---------|------|
547
-
|[`manual`](#relationships-has_many-manual){: #relationships-has_many-manual } |`(any, any -> any) \| module`|| A module that implements `Ash.Resource.ManualRelationship`. Also accepts a 2 argument function that takes the source records and the context. |
547
+
|[`manual`](#relationships-has_many-manual){: #relationships-has_many-manual } |`(any, any -> any) \| module`|| A module that implements `Ash.Resource.ManualRelationship`. Also accepts a 2 argument function that takes the source records and the context. Setting this will automatically set `no_attributes?` to `true`. |
548
548
|[`no_attributes?`](#relationships-has_many-no_attributes?){: #relationships-has_many-no_attributes? } |`boolean`|| All existing entities are considered related, i.e this relationship is not based on any fields, and `source_attribute` and `destination_attribute` are ignored. See the See the [relationships guide](/documentation/topics/resources/relationships.md) for more. |
549
549
|[`limit`](#relationships-has_many-limit){: #relationships-has_many-limit } |`integer`|| An integer to limit entries from loaded relationship. |
550
550
|[`description`](#relationships-has_many-description){: #relationships-has_many-description } |`String.t`|| An optional description for the relationship |
A module that implements `Ash.Resource.ManualRelationship`. Also accepts a 2 argument function that takes the source records and the context.
148
+
A module that implements `Ash.Resource.ManualRelationship`. Also accepts a 2 argument function that takes the source records and the context. Setting this will automatically set `no_attributes?` to `true`.
0 commit comments