Ash Elixir

AE

Ash Elixir

Join the community to ask questions about Ash Elixir and get answers from other members.

Join

support

showcase

today-i-learned

Does attribute and action order matter? and Upsert fields?

Given Declaration ``` defmodule MyApp.MyContext.Event do use Ash.Resource, data_layer: AshPostgres.DataLayer ...

Auth0 "Authentication Error" without any helpful details

I followed the instructions for Ash Authentication Phoenix and got password auth working with some help. Then I tried to switch to Auth0 using this quickstart: https://ash-hq.org/docs/guides/ash_authentication/latest/tutorials/auth0-quickstart Here are the changes I ended up with https://github.com/dewetblomerus/red/pull/2/files ...

belongs_to does not add _id attributes do resource

The resource with attributes and relationships ```elixir attributes do uuid_primary_key :id create_timestamp :inserted_at...

Bi-directional JSON/GraphQL interfaces

This isn't a feature request; just a question that will help me resolve an architecture question. Say I have an app with a number of separate services, each running in its own environment. These services need to pass some resources between themselves. Is there a way to define the resource with JSON or GQL is such a way that this resource can proxy between two services: client code on one service can make a request on the resource, which then forwards to the second service, with the answer being returned to the client?...

Attributes on `many_to_many` join/through resources.

Considering the following resources. ```ex defmodule Formula do use Ash.Resource, data_layer: Ash.DataLayer.Ets...

Policy vs FieldPolicy

I haven't used FieldPolicy before, but lets say I have a :role attribute that I want to control changes to. I.e: :god should be able to create users with all roles, :admin should only be able to create :admin and :user, and :user should not be able to create any roles - but still able to edit their own account i.e: change their email etc. Would a field policy be the place for that these days?

Complex types (postgres)

Is it possible to create (and use) complex types like this ```postgres CREATE DOMAIN dow AS integer CHECK( value BETWEEN 1 and 7...

Postgres' range types

What's the best approach for adding tstzrange type column to a resource?

add_tag but unique

A product has a many_to_many relationship to a tag (via a product_tag resource).
lib/app/shop/resources/product.ex ```elixir [...]...

How to add_tag? Managing Relationships

I try to adapt https://ash-hq.org/docs/guides/ash/latest/topics/managing-relationships for an application where a product which has a many_to_many relationship to tags. lib/app/shop/resources/product.ex ```elixir defmodule App.Shop.Product do...

many_to_many update problem

I have a product which has many_to_many tags. Creating works. Updating doesn't. Here's the resource code: lib/app/shop/resources/product.ex ```elixir defmodule App.Shop.Product do...

Identity on `attribute :some_attribute, {:array , EmbeddedResource}`

So if I have the following resource. ```elixir defmodule Resource do ... actions do...

GraphQL :type, prefix based on Context?

In the example docs, we have something like the following: ``` defmodule Helpdesk.Support.Ticket do ...omitted......

Preload relationship during action

I know we can use load to load an association during an action. However this only loads the relationship after the action is completed. I would like to do something like this: ```elixir action :update do change set_attribute(:starts_at, DateTime.utc_now(), new?: true)...

Cannot return null for non-nullable field

Hi Guys, I have an attribute in a resource that is a jsonb object in postgres and am defaulting it to an empty object in the db and also want to return it as an emoty object in GraphQL. However it seems to be returning null if the the object is empty... Is this something AshGraphQL is doing under the hood?...

Error while building reference

I'm trying to use the attributes of a relationship in a calculation but I get a runtime error. I attached my code and the error as a screenshot because Discord somehow prevents me from creating posts with more than 2000 characters.
No description

pub_sub compilation issue

After updating to ash main, commit id: 2813b3c9b2f45d1aec6aff2a64920404a42ac839 I'm getting the following error on compilation related to pub_sub Given this line in a pub_sub: publish :create, ["changed", :parent_id, [:id, nil]]...

Exception in transformer AshAuthentication.Strategy.Custom.Transformer

Hi there. I got an exception in transformer AshAuthentication.Strategy.Custom.Transformer when following the Authentication guide . Instead of User I set the resource name to Usuario. ```elixir...