oelshark89

oelshark89

How to show tag names in a dropdown for many-to-many relationships in AshAdmin?

Hello Ash community, happy to be part of this family!

I’m running into an issue while building a knowledge base. Each entry in my knowledge base should be associated with one or more tags. I’ve set up three tables:

  • tags (stores tag metadata)

  • entries (knowledge base items)

  • entry_tags (join table for many-to-many)

The problem: I’d like to select tags dynamically by name from a dropdown in AshAdmin. But this doesn’t work out of the box, because the Entry resource doesn’t have a direct belongs_to with Tag—it only has a many_to_many through EntryTag. If I add a belongs_to, I’d break 1NF and duplicate the relationship design.

What’s the recommended way in Ash to handle this? Ideally I’d like a clean dropdown (or multi-select) that shows tag names and correctly links them through the join table.

Any suggestions or best practices would be greatly appreciated!

Most Liked

zachdaniel

zachdaniel

Creator of Ash

Gotcha, yeah we probably need to add that functionality to ash_admin in that case :slight_smile:

Please open an issue

carlgleisner

carlgleisner

I’ve opened an issue for this now :hot_beverage:

https://github.com/ash-project/ash_admin/issues/362

@oelshark89, maybe you’re interested in having a look at the reproduction to see if it corresponds to your observations?

https://github.com/carlgleisner/ash_admin_dropdown_repro

oelshark89

oelshark89

Will try to look Into it

Last Post!

zachdaniel

zachdaniel

Creator of Ash

Okay, actually I am looking into this. It looks like this is setup only for when you are editing the foreign key directly via organization_id and only for belongs_to relationships currently.

the default create action is not using manage_relationship, and the non default one is. So it’s not anything to do with default or non-default. This just isn’t implemented for manage_relationship arguments.

Same for the original issue, this just isn’t implemented for many_to_many relationships. PRs welcome!

Where Next?

Popular in Questions Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54006 488
New
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New

We're in Beta

About us Mission Statement