kamaroly
How To Save Belongs To - Ash 3.0 Error ""Ash.Resource.Change.ManageRelationship does not implement `atomic/3`"
How to do I save belongs_to relationship?
I have Item and UnitMeasure resource. Item resource belongs to the UnitMeasure Resource.
Here is the relationship definition for the Item resource:
relationships do
belongs_to :unit_measure, Kamaro.Stock.UnitMeasure do
attribute_writable? true
end
end
According to Ash Relationship Tutorial, the following code should work
item
|> Ash.Changeset.for_update(:update, %{unit_measure_id: unit.id})
|> Ash.update()
But it is giving me an error that:
{:error,
%Ash.Error.framework{
errors: [
%Ash.Error.Framework.MustBeAtomic{
resource: Kamaro.Stock.Item,
action: :update,
reason: "Ash.Resource.Change.ManageRelationship does not implement `atomic/3`",
splode: Ash.Error,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :framework
}
]
}}
Marked As Solved
kamaroly
It worked after:
- I removed manage_relationship
- I added
:unit_measure_idin the default_accept
1
Also Liked
sevenseacat
Author of Ash Framework
That tutorial may be a little out of date as it references Ash 2. It should work as-is though - have you customized the update action in any way, and added a manage_relationship call? If so, you can safely remove it as it’s not necessary.
1
Popular in Questions
Hi,
I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
If I have a post route which an argument:
post /my_post_route/:my_param1, MyController.my_post_handler
How would get the post params ...
New
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
Good day to you all.
I have been struggling to get a query involving like and ilike to work.
Can anyone assist me on this, please?
pro...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
I have a User schema with a :from_id field set to type :string:
defmodule TweetBot.Repo.Migrations.CreateUsers do
use Ecto.Migration
...
New
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
Other popular topics
Hi All,
I set a environment variables in dev.exs , like below code.
when i start server, how can i set the ${enable} value?
thanks.
d...
New
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
Hello, I have map which I want to convert it to string like this:
the map:
%{last_name: "tavakkoli", name: "shahryar"}
the string I ne...
New
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
Using vs code and installed ElixirLS: support and debugger.
And I got an error popped up on start up says
Failed to run ‘elixir’ comma...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar.
I p...
New
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









