oelshark89

oelshark89

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!

Showing Posts 1 to 7

zachdaniel

zachdaniel

Creator of Ash

IIRC you can do this by using the label_field configuration on the tag resource, i.e

admin do
  label_field :name
end

I’m not sure actually if this is set up with many_to_many relationships or not :thinking: but couldn’t hurt to try :slight_smile:

oelshark89

oelshark89 OP

I gave this a try and it didn’t work. However, I’ve seen it work in another case where one table had a belongs_to relationship and the other had a has_many relationship with the same table.

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

zachdaniel

zachdaniel

Creator of Ash

Unfortunately, I just don’t have time to look into this one :cry: Hopefully some adventurous soul will look at ash_admin and see what can be done to extend this functionality to many_to_many relationships.

oelshark89

oelshark89 OP

Will try to look Into it

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!

— All posts loaded —

Where Next? Top

Trending in Questions Top

water
I’m aware of 2 such projects, are there others? git: GitHub - team-alembic/realworld: A fullstack Phoenix LiveView application with back...
New
katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Alvinkariuki
How Can I Optimise Compile Time Dependencies I have been building an elixir application for about 2 years now. Many modules and files ha...
New

Other Trending Topics Top

budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews