mirror of
https://github.com/ash-project/ash.git
synced 2024-09-20 13:33:20 +12:00
fix: force_change attrs *after* for_create/update
This commit is contained in:
parent
e60acf4167
commit
1b972b9598
1 changed files with 2 additions and 2 deletions
|
@ -714,6 +714,7 @@ defmodule Ash.Actions.ManagedRelationships do
|
|||
|
||||
relationship.through
|
||||
|> Ash.Changeset.new()
|
||||
|> Ash.Changeset.for_create(create_or_update, join_input)
|
||||
|> Ash.Changeset.force_change_attribute(
|
||||
relationship.source_field_on_join_table,
|
||||
Map.get(record, relationship.source_field)
|
||||
|
@ -722,7 +723,6 @@ defmodule Ash.Actions.ManagedRelationships do
|
|||
relationship.destination_field_on_join_table,
|
||||
Map.get(found, relationship.destination_field)
|
||||
)
|
||||
|> Ash.Changeset.for_create(create_or_update, join_input)
|
||||
|> Ash.Changeset.set_context(join_relationship.context)
|
||||
|> Ash.Changeset.set_tenant(changeset.tenant)
|
||||
|> api.create(
|
||||
|
@ -878,6 +878,7 @@ defmodule Ash.Actions.ManagedRelationships do
|
|||
|
||||
relationship.through
|
||||
|> Ash.Changeset.new()
|
||||
|> Ash.Changeset.for_create(join_action_name, join_params)
|
||||
|> Ash.Changeset.force_change_attribute(
|
||||
relationship.source_field_on_join_table,
|
||||
Map.get(record, relationship.source_field)
|
||||
|
@ -886,7 +887,6 @@ defmodule Ash.Actions.ManagedRelationships do
|
|||
relationship.destination_field_on_join_table,
|
||||
Map.get(created, relationship.destination_field)
|
||||
)
|
||||
|> Ash.Changeset.for_create(join_action_name, join_params)
|
||||
|> Ash.Changeset.set_context(join_relationship.context)
|
||||
|> Ash.Changeset.set_tenant(changeset.tenant)
|
||||
|> changeset.api.create(
|
||||
|
|
Loading…
Reference in a new issue