-
-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom change does not work without require_atomic? set to false #1770
Comments
This makes sense to me - did you get a warning that the change couldn't be run atomically? |
OHHHH. I totally missed this. Your What you would do instead is something like: @impl true
def atomic(_changeset, _opts, _context) do
%{tags: expr(some_postgres_fragment_that_adds_to_your_tags_list}
end |
This
errors out
at Line 2012 in 219771a
|
Two things:
def atomic(changeset, opts, _context) do
{:ok, new_value} = Ash.Changeset.fetch_argument(changeset, :tags_to_add)
{:atomic,
%{
opts[:attribute] => {:atomic, expr(fragment("array_cat(?, ?)", tags, ^new_value))}
}}
end |
that worked thanks
|
Describe the bug
a custom change does not update tags attribute unless require_atomic? is set to false
To Reproduce
Action, attribute and change
Expected behavior
it should update the tags attribute. update statement should have tags column
Runtime
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: