Ash Framework

AF

Ash Framework

The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.

Join

support

showcase

today-i-learned

How to extract first element from `many_to_many`

I have a many_to_many relationship and i want to get the first element from it. I have also a has_many relationship and can get the first element using has_one with from_many? but this is only the "merging" Resource. Is there something similar for many_to_many ? I can't use calculations or aggregations, because they can't return a resource so has_one seems to be the only one left....

How to `multitenancy :bypass` of nested/normal load

Hi, if i have a relation that has read_action which call the function which has multitenancy :bypass, i get this error ``` ** (Ash.Error.Invalid) Bread Crumbs:
Error returned from: MishkaDocument.Section.read...
Solution:
So set action: :master_read on the load call as well

Error to use `filter expr` with `manage_relationship` Unknown Error

Hi dear friends! i have a relation like this, as you see i added filter expr to prevent user not send request when they are not master user (without tenant and site_id) ```elixir has_many :master_versions, MishkaDocument.WorkspaceVersion do public? true destination_attribute :workspace_id...

column of relation does not exist - mix ash.codegen

Hey, (I'm pretty new) I've been running mix ash.codegen --dev a couple of times during development. I'm now finished with this feature and want to run mix ash.codegen add_columns_for_something but I get ERROR 42703 (undefined_column) column "email" of relation "users" does not exist....

mix -S phx.server failed

Hi, I started the Ash Framework tutorial on Elixir Mentor. I went through: 1) Installing Ash...

ChatOpenAIResponses, tools and AshAI

Hiya, I'm using Ash and AshAI for a new project, but I'm running in to some problems when I try to use LangChain.ChatModels.ChatOpenAIResponses instead of LangChain.ChatModels.ChatOpenAI when it comes to tools. If I expose a non-generic actions I get the following error complaining about additionalProperties in the schema generated by ash_ai....

Add order to many_to_many table

Hi all, I have a Human and Gift resources. Then I also have a HumanGifts many_to_many table to join the two resources. This table contains a human_id, a gift_id and an order of type integer. What I am trying to do is make it so that when a Human creates and sorts their gifts in the UI, the gifts are saved in the Gifts table but their order is persisted in the HumanGifts table. I have tried different things all day but have not been able to get this working via `manage_relat...
Solution:
and maybe order_is_key ```elixir update :manage_gifts do argument :gifts, {:array, :map}...

Full text search

Hi, I've got this calculation and a query that's trying to sort by it ```elixir read :full_text_search do...

Testing Filters

I'm writing a function that dynamically adds filters to an Ash.Query for AshBackpex. I'm not sure how to assert that I'm getting the filters back that I want. I can't figure out how to assert against this structure: ```elixir...

`relate_actor allow_nil? false` returning 400 error when `authorize_if actor_present()`

Hi friends, I have a question about change relate_actor. see my code, when i use default relate_actor which is allow_nil?: false, i get 400 error when i do not send user token or actor, for example without auth i send request ```elixir create :create do description "Follows a blogger" primary? true...

Upgrade from 3.5.12 to 3.7.6 Broke Calculcation

I'm getting this strange error suddenly: ```
Unknown Error ...

Display inputs_for when relation it still nil

Hi everyone, I have a resource called Person that has a has_one relationship to a contact_info resource. How can I get the inputs_for contact info to display on the front so that the user can basically "create or update" the contact info without clicking an "add contact info" button? Right now, the nested input fields do now display unless there is something already in the database for that user. Not sure if I am making sense. Thank you!
Solution:
You can add params to add_form

Problem to load `included` relation data - return `[]` list in AshJson without actor

Hi, i have a problem with load data of relation table in Json API. consider just use includes without paginated_includes (this problem still exist not just about paginated) ```elixir json_api do type "collection" ...
Solution:
First I did this and did not work! the :<relationship_name>_join_relationship dose not work for me, idk but
i told ai to create a debug file instead of accessing from https://gist.github.com/shahryarjb/2e2e94288f8edd04bd69e6b76d292f35 ...

Upgrade to 3.7.6 Broke FilterCheck

We're using Ash.Policy.FilterCheck and it seems the return type may have changed, we were returning true if all access, expr for subset access and false for no access. After upgrading, the true isn't letting any records come out. I saw the return type is either a keyword list or expression. What is the keyword list we should return?...

Trigger a add_form via a combobox click

is there a way to do this? I need to add new elements to the form via a searchable comboxbox....

How do I change the auth page logo?

Dumb question but google isn't helping. I want to change this logo
No description

Testing with Ash fail

Hi guys I'm using Ash Framework in my Elixir project, and I have several tests that depend on a relatively complex seeding process. My seeding logic involves ( using setup to run before each step ) :...

mix deps.compile failing for ash_authentication_phoenix

Here is the error message. ``` ==> ash_authentication_phoenix ...

when using ash typescript and rpc, not able to load other relations

Not able to load other relations like suppose we have two entities customers and users, where users consists of customers, I am not able to load cusstomers as part of users when using rpc

Testing `filter expr` inside `many_to_many` relation

Based on the help of Zach from https://github.com/ash-project/ash_json_api/pull/392#issuecomment-3417372205 I have a relation like this ```elixir many_to_many :all_posts, MishkaBlog.BlogPost do description "All blog posts (bypass tenant) that belong to this collection"...
Solution:
is_nil(type(^actor(:id), :uuid))