Raathmd
The step where previous_names are added is now preventing the save of an artist.
The artist table has the migrated field and the change function is in a separate module.
I see no messages in the terminal about why the save is not working.
How can i get some logging info from the submit action?
I added an inspect in the change function but nothing was output so i assume something is preventing it from executing this. I then added an input field for the previous_names field and started getting validation that it is required, even though allow_nil is true.
Any help appreciated.
Thanks
Trending in Questions
Hey guys,
I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly
Do you guys have any suggestions what is the best prac...
New
Hello!
Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app.
I creat...
New
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
Anyone here using Honeybadger?
My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of
Bandit.HTTPError...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hobbes is a low-level distributed database for the Elixir programming language.
Hobbes provides a simple, safe, and scalable storage lay...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
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
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #blog-post
- #elixirconf-us
- #elixir-ls
- #ai
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
zachdaniel
To answer your question more directly, there are a few things you can do to debug an action/form.
With the form
With a form that has been returned in the
{:error, form}case ofAshPhoenix.Form, you can doNot all errors are displayed in the form automatically because they may not tie to fields that are editable in the form itself. We also log a warning (IIRC that is the level) when we encounter an error that could not be displayed to the user due to not implementing the
AshPhoenix.FormData.Errorprotocol (a safety measure to avoid displaying internal details to the user.You can also peek at
form.source(orform.source.source, if you have a%Phoenix.Form{}in the action itself
You can add a hook like this to display the ok/error result from the action.
You’ll want to make sure that your action is not accepting
previous_namesas an input, and that your change is being run in all necessary places to set the attribute, that it has a default of[]etc.Raathmd
Thanks for your reply Zach. I inspected the result on save and go the following:
here is the update action:
zachdaniel
I imagine the book should call this out, but the answer to that is to add
require_atomic? falseto the update action.Raathmd
The action has require_atomic? false.
zachdaniel
Hmm…now that is interesting
Would it be possible for you to push your code as you have it to Github? I can take a look
Raathmd
I noticed int he network tab that the app is falling back to longpoll, could this be a reason?
Raathmd
https://github.com/Raathmd/tunez.git
ken-kost
It needs to be
change(changeset, opts, context), notchange(changeset, context)Also, I noticed you have duplicate migration files. That’s something that shouldn’t happen. You can not run
mix ash.setupwhile there are duplicates. I assume you were experimenting with snapshots?zachdaniel
@ken-kost is correct about the
def change/2being the issue. This is an interesting oneWe have logic for an
Ash.Resource.Changeto automatically perform itsatomic/3callback if there is nochange/3callback defined. So when we try to do that, we find that there is noatomic/3callback either, and that produces this error.Something common to do with behaviours in Elixir (which
Ash.Resource.Changeis one), is to use@impl trueor@impl BehaviourModuleabove each function that implements a callback of that behaviour. You can read more about that here: Typespecs reference — Elixir v1.18.3If you had
@impl trueabovedef change(changeset, context), you would get a warning about that not being an actual callback available.I think there are two things that we can do on our end to improve this:
@sevenseacat we can make sure to use
@impl truein all of our examples of change/validation/calculation callback functions.And for myself, I can add a check that at least one of
change/3,atomic/3orbatch_change/3is defined, as that is the minimum required for a change to function. That check also would have surfaced this issuesevenseacat
Can do! I always forget to put that in everywhere